src/JsRender/NodeToVala.vala
[app.Builder.js] / src / JsRender / NodeToVala.vala
1 /**
2  * 
3  * Code to convert node tree to Javascript...
4  * 
5  * usage : x = (new JsRender.NodeToJs(node)).munge();
6  * 
7  * 
8  * 
9  * 
10  * 
11 */
12
13
14
15
16 public class JsRender.NodeToVala : Object {
17
18         Node node;
19
20         int depth;
21         string inpad;
22         string pad;
23         string ipad;
24         string cls;
25         string xcls;
26         
27         string ret;
28         
29         int cur_line;
30
31         Gee.ArrayList<string> ignoreList;
32         Gee.ArrayList<string> ignoreWrappedList; 
33         Gee.ArrayList<string> myvars;
34         Gee.ArrayList<Node> vitems; // top level items
35         NodeToVala top;
36         JsRender file;
37         
38         /* 
39          * ctor - just initializes things
40          * - wraps a render node 
41          */
42         public NodeToVala( Node node,  int depth, NodeToVala? parent) 
43         {
44
45                 
46                 this.node = node;
47                 this.depth = depth;
48                 this.inpad = string.nfill(depth > 0 ? 4 : 0, ' ');
49                 this.pad = this.inpad + "    ";
50                 this.ipad = this.inpad + "        ";
51                 this.cls = node.xvala_cls;
52                 this.xcls = node.xvala_xcls;
53                 this.ret = "";
54                 this.cur_line = parent == null ? 0 : parent.cur_line;
55                 
56                 
57                 this.top = parent == null ? this : parent.top;
58                 this.ignoreList = new Gee.ArrayList<string>();
59                 this.ignoreWrappedList  = new Gee.ArrayList<string>();
60                 this.myvars = new Gee.ArrayList<string>();
61                 this.vitems = new Gee.ArrayList<Node>();
62                 this.file = null;
63                 
64                 // initialize line data..
65                 node.line_start = this.cur_line;
66                 node.line_end  = this.cur_line;
67                 node.lines = new Gee.ArrayList<int>();
68                 node.line_map = new Gee.HashMap<int,string>();
69                 if (parent == null) {
70                         node.node_lines = new Gee.ArrayList<int>();
71                         node.node_line_map = new Gee.HashMap<int,Node>();
72                  }
73                 
74         }
75
76         public int vcnt = 0;
77         string toValaNS(Node item)
78         {
79                 var ns = item.get("xns") ;
80                 if (ns == "GtkSource") {
81                         return "Gtk.Source";
82                 }
83                 return ns + ".";
84         }
85         public void  toValaName(Node item, int depth =0) 
86         {
87                 this.vcnt++;
88
89                 var ns =  this.toValaNS(item) ;
90                 var cls = ns + item.get("xtype");
91                 
92                 
93                 item.xvala_cls = cls;
94                 
95                 
96                 string id = item.get("id").length > 0 ?
97                         item.get("id") :  "%s%d".printf(item.get("xtype"), this.vcnt);
98
99                 
100                 
101                 
102                 if (id[0] == '*' || id[0] == '+') {
103                         item.xvala_xcls = "Xcls_" + id.substring(1);
104                 } else {
105                         item.xvala_xcls = "Xcls_" + id;
106                 }
107                         
108                 
109                 item.xvala_id =  id;
110                 if (depth > 0) {                        
111                         this.vitems.add(item);
112                 } else if (!item.props.has_key("id")) {
113                         // use the file name..
114                         item.xvala_xcls =  this.file.name;
115                         // is id used?
116                         item.xvala_id = this.file.name;
117
118                 }
119                 // loop children..
120                                                                                                                            
121                 if (item.items.size < 1) {
122                         return;
123                 }
124                 for(var i =0;i<item.items.size;i++) {
125                         this.toValaName(item.items.get(i), depth+1);
126                 }
127                                           
128         }
129         /**
130          *  Main entry point to convert a file into a string..
131          */
132         public static string mungeFile(JsRender file) 
133         {
134                 if (file.tree == null) {
135                         return "";
136                 }
137
138                 var n = new NodeToVala(file.tree, 0, null);
139                 n.file = file;
140                 n.vcnt = 0;
141                 
142                 n.toValaName(file.tree);
143                 
144                 
145                 GLib.debug("top cls %s / xlcs %s\n ",file.tree.xvala_cls,file.tree.xvala_cls); 
146                 n.cls = file.tree.xvala_cls;
147                 n.xcls = file.tree.xvala_xcls;
148                 return n.munge();
149                 
150
151         }
152         
153         public string munge ( )
154         {
155                 //return this.mungeToString(this.node);
156
157                 this.ignore("pack");
158                 this.ignore("init");
159                 this.ignore("xns");
160                 this.ignore("xtype");
161                 this.ignore("id");
162                 
163                 this.globalVars();
164                 this.classHeader();
165                 this.addSingleton();
166                 this.addTopProperties();
167                 this.addMyVars();
168                 this.addPlusProperties();
169                 this.addValaCtor();
170                 this.addUnderThis();
171                 this.addWrappedCtor();
172
173                 this.addInitMyVars();
174                 this.addWrappedProperties();
175                 this.addChildren();
176                 this.addInit();
177                 this.addListeners();
178                 this.addEndCtor();
179                 this.addUserMethods();
180                 this.iterChildren();
181                 
182                 return this.ret;
183                  
184                          
185         } 
186         public string mungeChild(  Node cnode)
187         {
188                 var x = new  NodeToVala(cnode,  this.depth+1, this);
189                 return x.munge();
190         }
191         public void addLine(string str= "")
192         {
193                 this.cur_line++;
194                 //this.ret += "/*%d*/ ".printf(this.cur_line-1) + str + "\n";
195                 this.ret += str + "\n";
196         }
197         public void addMultiLine(string str= "")
198         {
199                 var l = this.cur_line;
200                 this.cur_line += str.split("\n").length;
201                 //this.ret +=  "/*%d*/ ".printf(l) + str + "\n";
202                 this.ret +=   str + "\n";
203         }
204          
205         
206         public void globalVars()
207         {
208                 if (this.depth > 0) {
209                         return;
210                 }
211                 // Global Vars..??? when did this get removed..?
212                 //this.ret += this.inpad + "public static " + this.xcls + "  " + this.node.xvala_id+ ";\n\n";
213
214                 this.addLine(this.inpad + "static " + this.xcls + "  _" + this.node.xvala_id+ ";");
215                 this.addLine();
216                    
217         }
218
219         void classHeader()
220         {
221                            
222                 // class header..
223                 // class xxx {   WrappedGtk  el; }
224                 this.node.line_start = this.cur_line;
225                 this.addLine(inpad + "public class " + this.xcls + " : Object");
226                 this.addLine(this.inpad + "{");
227                 
228                  
229                 this.addLine(this.pad + "public " + this.cls + " el;");
230  
231                 this.addLine(this.pad + "private " + this.top.xcls + "  _this;");
232                 this.addLine();
233                         
234                         
235                         
236                         // singleton
237         }
238         void addSingleton() 
239         {
240                 if (depth > 0) {
241                         return;
242                 }
243                 this.addLine(pad + "public static " + xcls + " singleton()");
244                 this.addLine(this.pad + "{");
245                 this.addLine(this.ipad +    "if (_" + this.node.xvala_id  + " == null) {");
246                 this.addLine(this.ipad +    "    _" + this.node.xvala_id + "= new "+ this.xcls + "();");  // what about args?
247                 this.addLine(this.ipad +    "}");
248                 this.addLine(this.ipad +    "return _" + this.node.xvala_id +";");
249                 this.addLine(this.pad + "}");
250         }
251                         
252         /**
253          * when ID is used... on an element, it registeres a property on the top level...
254          * so that _this.ID always works..
255          * 
256          */
257         void addTopProperties()
258         {
259                 if (this.depth > 0) {
260                         return;
261                 }
262                 // properties - global..??
263
264                 var iter = this.vitems.list_iterator();
265                 while(iter.next()) {
266                         var n = iter.get();
267
268                          
269                         if (!n.props.has_key("id") || n.xvala_id.length < 0) {
270                                 continue;
271                                 
272                         }
273                         if (n.xvala_id[0] == '*') {
274                                 continue;
275                         }
276                         if (n.xvala_id[0] == '+') {
277                                 continue;
278                         }
279                         this.addLine(this.pad + "public " + n.xvala_xcls + " " + n.xvala_id + ";");
280                         
281                 }
282                                 
283         }
284         /**
285          * create properties that are not 'part of the wrapped element.
286          * 
287          * 
288          */
289         
290         void addMyVars()
291         {
292                 this.addLine();
293                 this.addLine(this.ipad + "// my vars (def)");
294                         
295
296  
297                 var cls = Palete.Gir.factoryFqn(this.node.fqn());
298                    
299                 if (cls == null) {
300                         return;
301                 }
302           
303                 
304                         // Key = TYPE:name
305                 var iter = this.node.props.map_iterator();
306                 while (iter.next()) {
307                         var k = iter.get_key();
308                         if (this.shouldIgnore(k)) {
309                                 continue;
310                         }
311                         var vv = k.strip().split(" ");
312                         // user defined method
313                         if (vv[0] == "|") {
314                                 continue;
315                         }
316                         if (vv[0] == "*") {
317                                 continue;
318                         }
319                                 
320                         if (vv[0] == "@") {
321                                 this.node.setLine(this.cur_line, "p", k);
322                                 this.addLine(this.pad + "public signal" + k.substring(1)  + " "  + iter.get_value() + ";");
323                                 
324                                 this.ignore(k);
325                                 continue;
326                         }
327                         var min = (vv[0] == "$" || vv[0] == "#") ? 3 : 2; 
328                         if (vv.length < min) {
329                                 // skip 'old js style properties without a type'
330                                 continue;
331                         }
332                         
333                         var kname = vv[vv.length-1];
334
335                         if (this.shouldIgnore(kname)) {
336                                 continue;
337                         }
338                         
339                         // is it a class property...
340                         if (cls.props.has_key(kname) && vv[0] != "#") {
341                                 continue;
342                         }
343                         
344                         this.myvars.add(k);
345                         this.node.setLine(this.cur_line, "p", k);
346                         
347                         this.addLine(this.pad + "public " + 
348                                 (k[0] == '$' || k[0] == '#' ? k.substring(2) : k ) + ";");
349                                 
350                         this.ignore(k);
351                         
352                                 
353                 }
354         }
355         
356         // if id of child is '+' then it's a property of this..
357         void addPlusProperties()
358         {
359                 if (this.node.items.size < 1) {
360                         return;
361                 }
362                 var iter = this.node.items.list_iterator();
363                 while (iter.next()) {
364                         var ci = iter.get();
365                                 
366                         if (ci.xvala_id[0] != '+') {
367                                 continue; // skip generation of children?
368                                 
369                         }
370                          
371                         this.addLine(this.pad + "public " + ci.xvala_xcls + " " + ci.xvala_id.substring(1) + ";");
372                                            
373                         
374                 }
375         }
376         /**
377          * add the constructor definition..
378          */
379         void addValaCtor()
380         {
381                         
382                 
383                 // .vala props.. 
384                 
385                 string[] cargs = {};
386                 var cargs_str = "";
387                 // ctor..
388                 this.addLine();
389                 this.addLine(this.pad + "// ctor");
390                 
391                 if (this.node.has("* args")) {
392                         // not sure what this is supposed to be ding..
393                 
394                         cargs_str = ", " + this.node.get("* args");
395                         //var ar = this.node.get("* args");.split(",");
396                         //for (var ari =0; ari < ar.length; ari++) {
397                                 //      cargs +=  (ar[ari].trim().split(" ").pop();
398                                   // }
399                         }
400         
401                 if (this.depth < 1) {
402                  
403                         // top level - does not pass the top level element..
404                         this.addLine(this.pad + "public " + this.xcls + "(" +  cargs_str +")");
405                         this.addLine(this.pad + "{");
406                 } else {
407                                 
408                         // for sub classes = we passs the top level as _owner
409                         this.addLine(this.pad + "public " + this.xcls + "(" +  this.top.xcls + " _owner " + cargs_str + ")");
410                         this.addLine(this.pad + "{");
411                 }
412                 
413
414         }
415         /**
416          *  make sure _this is defined..
417          */
418         void addUnderThis() 
419         {
420                 // public static?
421                 if (depth < 1) {
422                         this.addLine( this.ipad + "_this = this;");
423                         return;
424                 }
425                 // for non top level = _this point to owner, and _this.ID is set
426                 
427                 this.addLine( this.ipad + "_this = _owner;");
428
429                 if (this.node.props.has_key("id")
430                         &&
431                         this.node.xvala_id != "" 
432                         && 
433                         this.node.xvala_id[0] != '*' 
434                         && 
435                         this.node.xvala_id[0] != '+' 
436                         ) {
437                                 this.addLine( this.ipad + "_this." + node.xvala_id  + " = this;");
438                    
439                 }
440                          
441         }
442         /**
443          * Initialize this.el to point to the wrapped element.
444          * 
445          * 
446          */
447
448         void addWrappedCtor()
449         {
450                 // wrapped ctor..
451                 // this may need to look up properties to fill in the arguments..
452                 // introspection does not workk..... - as things like gtkmessagedialog
453                 /*
454                 if (cls == 'Gtk.Table') {
455
456                 var methods = this.palete.getPropertiesFor(cls, 'methods');
457
458                 print(JSON.stringify(this.palete.proplist[cls], null,4));
459                 Seed.quit();
460                 }
461                 */
462                 if (this.node.has("* ctor")) {
463                         this.node.setLine(this.cur_line, "p", "* ctor");
464                         this.addLine(this.ipad + "this.el = " + this.node.get("* ctor")+ ";");
465                         return;
466                 }
467                  
468                 var  default_ctor = Palete.Gir.factoryFqn(this.node.fqn() + ".new");
469
470                  
471                 if (default_ctor != null && default_ctor.paramset != null && default_ctor.paramset.params.size > 0) {
472                         string[] args  = {};
473                         var iter =default_ctor.paramset.params.list_iterator();
474                         while (iter.next()) {
475                                 var n = iter.get().name;
476                                 if (!this.node.has(n)) {
477
478                                         if (iter.get().type.contains("int")) {
479                                                 args += "0";
480                                                 continue;
481                                         }
482                                         if (iter.get().type.contains("float")) {
483                                                 args += "0f";
484                                                 continue;
485                                         }
486                                         if (iter.get().type.contains("bool")) {
487                                                 args += "true"; // always default to true?
488                                                 continue;
489                                         }
490                                         // any other types???
491                                         
492                                         args += "null";
493                                         continue;
494                                 }
495                                 this.ignoreWrapped(n);
496                                 this.ignore(n);
497                                 
498                                 var v = this.node.get(n);
499
500                                 if (iter.get().type == "string") {
501                                         v = "\"" +  v.escape("") + "\"";
502                                 }
503                                 if (v == "TRUE" || v == "FALSE") {
504                                         v = v.down();
505                                 }
506
507                                 
508                                 args += v;
509
510                         }
511                         this.node.setLine(this.cur_line, "p", "* xtype");
512                         
513                         this.addLine(this.ipad + "this.el = new " + cls + "( "+ string.joinv(", ",args) + " );") ;
514                         return;
515                         
516                 }
517                 this.node.setLine(this.cur_line, "p", "* xtype");;
518                 
519                 this.addLine(this.ipad + "this.el = new " + this.cls + "();");
520
521                         
522         }
523
524         void addInitMyVars()
525         {
526                         //var meths = this.palete.getPropertiesFor(item['|xns'] + '.' + item.xtype, 'methods');
527                         //print(JSON.stringify(meths,null,4));Seed.quit();
528                         
529                         
530                         
531                         // initialize.. my vars..
532                 this.addLine();
533                 this.addLine( this.ipad + "// my vars (dec)");
534                 
535                 var iter = this.myvars.list_iterator();
536                 while(iter.next()) {
537                         
538                         var k = iter.get();
539                         
540                         var ar  = k.strip().split(" ");
541                         var kname = ar[ar.length-1];
542                         
543                         var v = this.node.props.get(k);
544                         // ignore signals.. 
545                         if (v.length < 1) {
546                                 continue; 
547                         }
548                         if (v == "FALSE" || v == "TRUE") {
549                                 v = v.down();
550                         }
551                         //FIXME -- check for raw string.. "string XXXX"
552                         
553                         // if it's a string...
554                         
555                         
556                         this.addLine(this.ipad + "this." + kname + " = " +   v +";");
557                 }
558         }
559
560         
561
562
563         
564         void addWrappedProperties()
565         {
566                 var cls = Palete.Gir.factoryFqn(this.node.fqn());
567                 if (cls == null) {
568                         return;
569                 }
570                         // what are the properties of this class???
571                 this.addLine();
572                 this.addLine(this.ipad + "// set gobject values");
573                 
574
575                 var iter = cls.props.map_iterator();
576                 while (iter.next()) {
577                         var p = iter.get_key();
578                         print("Check Write %s\n", p);
579                         if (!this.node.has(p)) {
580                                 continue;
581                         }
582                         if (this.shouldIgnoreWrapped(p)) {
583                                 continue;
584                         }
585                         
586                                 this.ignore(p);
587                         var v = this.node.get(p);
588
589                         var nodekey = this.node.get_key(p);
590
591                         // user defined properties.
592                         if (nodekey[0] == '#') {
593                                 continue;
594                         }
595                                 
596
597                         
598                         var is_raw = nodekey[0] == '$';
599                         
600                         // what's the type.. - if it's a string.. then we quote it..
601                         if (iter.get_value().type == "string" && !is_raw) {
602                                  v = "\"" +  v.escape("") + "\"";
603                         }
604                         if (v == "TRUE" || v == "FALSE") {
605                                 v = v.down();
606                         }
607                         if (iter.get_value().type == "float" && v[v.length-1] != 'f') {
608                                 v += "f";
609                         }
610                         
611                         
612                         this.addLine("%sthis.el.%s = %s;".printf(ipad,p,v)); // // %s,  iter.get_value().type);
613                                         
614                            // got a property..
615                            
616
617                 }
618                 
619         }
620         /**
621          *  pack the children into the parent.
622          * 
623          * if the child's id starts with '*' then it is not packed...
624          * - this allows you to define children and add them manually..
625          */
626
627         void addChildren()
628         {
629                                 //code
630                 if (this.node.items.size < 1) {
631                         return;
632                 }
633                          
634                 var iter = this.node.items.list_iterator();
635                 var i = -1;
636                 while (iter.next()) {
637                         i++;
638                                 
639                         var ci = iter.get();
640
641                         if (ci.xvala_id[0] == '*') {
642                                 continue; // skip generation of children?
643                         }
644                                         
645                         var xargs = "";
646                         if (ci.has("* args")) {
647                                 
648                                 var ar = ci.get("* args").split(",");
649                                 for (var ari = 0 ; ari < ar.length; ari++ ) {
650                                         var arg = ar[ari].split(" ");
651                                         xargs += "," + arg[arg.length -1];
652                                 }
653                         }
654                         // create the element..
655                         this.addLine(this.ipad + "var child_" + "%d".printf(i) + " = new " + ci.xvala_xcls +
656                                         "( _this " + xargs + ");" );
657                         
658                         // this is only needed if it does not have an ID???
659                         this.addLine(this.ipad + "child_" + "%d".printf(i) +".ref();"); // we need to reference increase unnamed children...
660                         
661                         if (ci.has("* prop")) {
662                                 this.addLine(ipad + "this.el." + ci.get("* prop") + " = child_" + "%d".printf(i) + ".el;");
663                                 continue;
664                         } 
665                                 
666
667         // not sure why we have 'true' in pack?!?
668                         if (!ci.has("pack") || ci.get("pack").down() == "false" || ci.get("pack").down() == "true") {
669                                 continue;
670                         }
671                         
672                         string[]  packing =  { "add" };
673                         if (ci.has("pack")) {
674                                 packing = ci.get("pack").split(",");
675                         }
676                         
677                         var pack = packing[0];
678                         this.addLine(this.ipad + "this.el." + pack.strip() + " (  child_" + "%d".printf(i) + ".el " +
679                                    (packing.length > 1 ? 
680                                                 (", " + string.joinv(",", packing).substring(pack.length+1))
681                                         :
682                                                         ""
683                                                 ) + " );");
684         
685                                           
686                         if (ci.xvala_id[0] != '+') {
687                                 continue; // skip generation of children?
688                                                 
689                         }
690                         // this.{id - without the '+'} = the element...
691                         this.addLine(this.ipad + "this." + ci.xvala_id.substring(1) + " =  child_" + "%d".printf(i) +  ";");
692                                   
693                 }
694         }
695
696         void addInit()
697         {
698
699                 
700                 if (!this.node.has("init")) {
701                                 return;
702                 }
703                 this.addLine();
704                 this.addLine(ipad + "// init method");
705                 this.addLine();
706                 this.node.setLine(this.cur_line, "p", "init");
707                 
708                 this.addMultiLine(ipad + this.padMultiline(ipad, this.node.get("init")) );
709
710          }
711          void addListeners()
712          {
713                 if (this.node.listeners.size < 1) {
714                         return;
715                 }
716                                 
717                 this.addLine();
718                 this.addLine(ipad + "//listeners");
719                         
720                          
721
722                 var iter = this.node.listeners.map_iterator();
723                 while (iter.next()) {
724                         var k = iter.get_key();
725                         var v = iter.get_value();
726                         
727                         this.node.setLine(this.cur_line, "l", k);
728                         this.addMultiLine(this.ipad + "this.el." + k + ".connect( " + 
729                                         this.padMultiline(this.ipad,v) +");"); 
730                                 
731                 }
732         }    
733         void addEndCtor()
734         {
735                          
736                         // end ctor..
737                         this.addLine(this.pad + "}");
738         }
739
740
741         /*
742  * Standardize this crap...
743  * 
744  * standard properties (use to set)
745  *          If they are long values show the dialog..
746  *
747  * someprop : ....
748  * bool is_xxx  :: can show a pulldown.. (true/false)
749  * string html  
750  * $ string html  = string with value interpolated eg. baseURL + ".." 
751  *  Clutter.ActorAlign x_align  (typed)  -- shows pulldowns if type is ENUM? 
752  * $ untypedvalue = javascript untyped value...  
753  * _ string html ... = translatable..
754
755  * 
756  * object properties (not part of the GOjbect being wrapped?
757  * # Gee.ArrayList<Xcls_fileitem> fileitems
758  * 
759  * signals
760  * @ void open 
761  * 
762  * methods -- always text editor..
763  * | void clearFiles
764  * | someJSmethod
765  * 
766  * specials
767  * * prop -- string
768  * * args  -- string
769  * * ctor -- string
770  * * init -- big string?
771  * 
772  * event handlers (listeners)
773  *   just shown 
774  * 
775  * -----------------
776  * special ID values
777  *  +XXXX -- indicates it's a instance property / not glob...
778  *  *XXXX -- skip writing glob property (used as classes that can be created...)
779  * 
780  * 
781  */
782          
783         void addUserMethods()
784         {
785                 this.addLine();
786                 this.addLine(this.pad + "// user defined functions");
787                         
788                         // user defined functions...
789                 var iter = this.node.props.map_iterator();
790                 while(iter.next()) {
791                         var k = iter.get_key();
792                         if (this.shouldIgnore(k)) {
793                                 continue;
794                         }
795                         // HOW TO DETERIME if its a method?            
796                         if (k[0] != '|') {
797                                         //strbuilder("\n" + pad + "// skip " + k + " - not pipe \n"); 
798                                         continue;
799                         }
800                         
801                         // function in the format of {type} (args) { .... }
802                         var kk = k.substring(2);
803                         var vv = iter.get_value();
804                         this.node.setLine(this.cur_line, "p", k);
805                         this.addMultiLine(this.pad + "public " + kk + " " + this.padMultiline(this.pad, vv));;
806                         
807                                 
808                 }
809         }
810
811         void iterChildren()
812         {
813                 this.node.line_end = this.cur_line;
814                 this.node.sortLines();
815                 
816                         
817                 if (this.depth > 0) {
818                         this.addLine(this.inpad + "}");
819                 }
820                 
821                 var iter = this.node.items.list_iterator();
822                 var i = -1;
823                 while (iter.next()) {
824                         this.addMultiLine(this.mungeChild(iter.get()));
825                 }
826                          
827                 if (this.depth < 1) {
828                         this.addLine(this.inpad + "}");
829                 }
830                         
831         }
832
833         string padMultiline(string pad, string str)
834         {
835                 var ar = str.strip().split("\n");
836                 return string.joinv("\n" + pad , ar);
837         }
838         
839         void ignore(string i) {
840                 this.ignoreList.add(i);
841                 
842         }
843         void ignoreWrapped(string i) {
844                 this.ignoreWrappedList.add(i);
845                 
846         }
847         bool shouldIgnore(string i)
848         {
849                 return ignoreList.contains(i);
850         }
851         bool shouldIgnoreWrapped(string i)
852         {
853                 return ignoreWrappedList.contains(i);
854         }
855         
856 }
857         
858          
859         
860         
861
862