First NIT release and new clean mercurial repository
[nit.git] / c_src / utils._sep.c
1 #include "utils._sep.h"
2 val_t utils___Object___cmangle(val_t self, val_t param0) {
3 struct trace_t trace = {NULL, "utils::Object::cmangle (src/utils.nit:21,1--55:11)"};
4 val_t variable0;
5 val_t variable1;
6 val_t variable2;
7 static val_t once_value_variable2_1; static int once_bool_variable2_1;
8 val_t variable3;
9 val_t variable4;
10 val_t variable5;
11 val_t variable6;
12 val_t variable7;
13 val_t variable8;
14 val_t variable9;
15 val_t variable10;
16 val_t variable11;
17 val_t variable12;
18 trace.prev = tracehead; tracehead = &trace;
19 /* check if p<Array[Symbol] with p:Symbol */
20 if (( param0!=NIT_NULL) && !VAL_ISA( param0, COLOR_Array, ID_Array)) { fprintf(stderr, "Cast failled at src/utils.nit:22,14--31\n"); nit_exit(1); } /*cast Array[Symbol]*/;
21 variable0 = param0;
22 if (once_bool_variable2_1) variable2 = once_value_variable2_1;
23 else {
24 variable2 = ((utils___Object___cmangle_table_t)CALL( self,COLOR_utils___Object___cmangle_table))( self) /*Object::cmangle_table*/;
25 once_value_variable2_1 = variable2;
26 once_bool_variable2_1 = true;
27 }
28 variable1 = variable2;
29 variable3 = NEW_string___String___init(); /*new String*/
30 variable2 = variable3;
31 variable3 = ((array___AbstractArray___iterator_t)CALL( variable0 /*symbols*/,COLOR_abstract_collection___Collection___iterator))( variable0 /*symbols*/) /*Array::iterator*/;
32 while (true) { /*for*/
33 variable4 = ((array___ArrayIterator___is_ok_t)CALL(variable3,COLOR_abstract_collection___Iterator___is_ok))(variable3) /*ArrayIterator::is_ok*/;
34 if (!UNTAG_Bool(variable4)) break; /*for*/
35 variable4 = ((array___ArrayIterator___item_t)CALL(variable3,COLOR_abstract_collection___Iterator___item))(variable3) /*ArrayIterator::item*/;
36 variable5 = ((array___AbstractArray___is_empty_t)CALL( variable2 /*res*/,COLOR_abstract_collection___Collection___is_empty))( variable2 /*res*/) /*String::is_empty*/;
37 if (UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable5)))) { /*if*/
38 ((string___String___add_t)CALL( variable2 /*res*/,COLOR_abstract_collection___SimpleCollection___add))( variable2 /*res*/, TAG_Char('_')) /*String::add*/;
39 ((string___String___add_t)CALL( variable2 /*res*/,COLOR_abstract_collection___SimpleCollection___add))( variable2 /*res*/, TAG_Char('_')) /*String::add*/;
40 ((string___String___add_t)CALL( variable2 /*res*/,COLOR_abstract_collection___SimpleCollection___add))( variable2 /*res*/, TAG_Char('_')) /*String::add*/;
41 }
42 variable5 = TAG_Bool(false);
43 variable6 = TAG_Bool(true);
44 variable8 = ((symbol___Symbol___to_s_t)CALL( variable4 /*sym*/,COLOR_string___Object___to_s))( variable4 /*sym*/) /*Symbol::to_s*/;
45 variable7 = variable8;
46 variable8 = ((array___AbstractArray___iterator_t)CALL( variable7 /*s*/,COLOR_abstract_collection___Collection___iterator))( variable7 /*s*/) /*String::iterator*/;
47 while (true) { /*for*/
48 variable9 = ((array___ArrayIterator___is_ok_t)CALL(variable8,COLOR_abstract_collection___Iterator___is_ok))(variable8) /*ArrayIterator::is_ok*/;
49 if (!UNTAG_Bool(variable9)) break; /*for*/
50 variable9 = ((array___ArrayIterator___item_t)CALL(variable8,COLOR_abstract_collection___Iterator___item))(variable8) /*ArrayIterator::item*/;
51 variable10 = TAG_Bool(UNTAG_Char( variable9 /*c*/)>=UNTAG_Char( TAG_Char('a')));
52 variable11 = variable10;
53 if (UNTAG_Bool(variable11)) { /* and */
54 variable11 = TAG_Bool(UNTAG_Char( variable9 /*c*/)<=UNTAG_Char( TAG_Char('z')));
55 }
56 variable10 = variable11;
57 variable11 = variable10;
58 if (!UNTAG_Bool(variable11)) { /* or */
59 variable11 = TAG_Bool(UNTAG_Char( variable9 /*c*/)>=UNTAG_Char( TAG_Char('A')));
60 variable12 = variable11;
61 if (UNTAG_Bool(variable12)) { /* and */
62 variable12 = TAG_Bool(UNTAG_Char( variable9 /*c*/)<=UNTAG_Char( TAG_Char('Z')));
63 }
64 variable11 = variable12;
65 }
66 variable10 = variable11;
67 variable11 = variable10;
68 if (!UNTAG_Bool(variable11)) { /* or */
69 variable11 = TAG_Bool(UNTAG_Char( variable9 /*c*/)>=UNTAG_Char( TAG_Char('0')));
70 variable12 = variable11;
71 if (UNTAG_Bool(variable12)) { /* and */
72 variable12 = TAG_Bool(UNTAG_Char( variable9 /*c*/)<=UNTAG_Char( TAG_Char('9')));
73 }
74 variable11 = variable12;
75 }
76 variable10 = variable11;
77 if (UNTAG_Bool(variable10)) { /*if*/
78 ((string___String___add_t)CALL( variable2 /*res*/,COLOR_abstract_collection___SimpleCollection___add))( variable2 /*res*/, variable9 /*c*/) /*String::add*/;
79 variable5 = TAG_Bool(false) /*underscore=*/;
80 variable6 = TAG_Bool(true) /*normal=*/;
81 } else { /*if*/
82 variable10 = TAG_Bool(( variable9 /*c*/)==( TAG_Char('_')));
83 variable11 = variable10;
84 if (UNTAG_Bool(variable11)) { /* and */
85 variable11 = TAG_Bool(!UNTAG_Bool( variable5 /*underscore*/));
86 }
87 variable10 = variable11;
88 if (UNTAG_Bool(variable10)) { /*if*/
89 ((string___String___add_t)CALL( variable2 /*res*/,COLOR_abstract_collection___SimpleCollection___add))( variable2 /*res*/, variable9 /*c*/) /*String::add*/;
90 variable5 = TAG_Bool(true) /*underscore=*/;
91 variable6 = TAG_Bool(true) /*normal=*/;
92 } else { /*if*/
93 variable10 = ((abstract_collection___CoupleMap___has_key_t)CALL( variable1 /*table*/,COLOR_abstract_collection___Map___has_key))( variable1 /*table*/, variable9 /*c*/) /*HashMap::has_key*/;
94 if (UNTAG_Bool(variable10)) { /*if*/
95 if (UNTAG_Bool( variable6 /*normal*/)) { /*if*/
96 ((string___String___add_t)CALL( variable2 /*res*/,COLOR_abstract_collection___SimpleCollection___add))( variable2 /*res*/, TAG_Char('_')) /*String::add*/;
97 ((string___String___add_t)CALL( variable2 /*res*/,COLOR_abstract_collection___SimpleCollection___add))( variable2 /*res*/, TAG_Char('_')) /*String::add*/;
98 }
99 variable10 = ((abstract_collection___CoupleMap_____bra_t)CALL( variable1 /*table*/,COLOR_abstract_collection___Map_____bra))( variable1 /*table*/, variable9 /*c*/) /*HashMap::[]*/;
100 ((string___String___append_t)CALL( variable2 /*res*/,COLOR_abstract_collection___IndexedCollection___append))( variable2 /*res*/, variable10) /*String::append*/;
101 variable6 = TAG_Bool(false) /*normal=*/;
102 variable5 = TAG_Bool(false) /*underscore=*/;
103 }
104 }
105 }
106 continue_3: while(0);
107 ((array___ArrayIterator___next_t)CALL(variable8,COLOR_abstract_collection___Iterator___next))(variable8) /*ArrayIterator::next*/;
108 }
109 break_3: while(0);
110 continue_2: while(0);
111 ((array___ArrayIterator___next_t)CALL(variable3,COLOR_abstract_collection___Iterator___next))(variable3) /*ArrayIterator::next*/;
112 }
113 break_2: while(0);
114 variable1 = variable2 /*res*/;
115 goto return_label0;
116 return_label0: while(false);
117 tracehead = trace.prev;
118 return variable1;
119 }
120 val_t utils___Object___cmangle_table(val_t self) {
121 struct trace_t trace = {NULL, "utils::Object::cmangle_table (src/utils.nit:58,1--74:11)"};
122 val_t variable0;
123 val_t variable1;
124 trace.prev = tracehead; tracehead = &trace;
125 variable1 = NEW_hash___HashMap___init(); /*new HashMap[Char, String]*/
126 variable0 = variable1;
127 variable1 = NEW_string___String___with_native(BOX_NativeString("plus"), TAG_Int(4)); /*new String*/
128 ((hash___HashMap_____braeq_t)CALL( variable0 /*res*/,COLOR_abstract_collection___Map_____braeq))( variable0 /*res*/, TAG_Char('+'), variable1) /*HashMap::[]=*/;
129 variable1 = NEW_string___String___with_native(BOX_NativeString("minus"), TAG_Int(5)); /*new String*/
130 ((hash___HashMap_____braeq_t)CALL( variable0 /*res*/,COLOR_abstract_collection___Map_____braeq))( variable0 /*res*/, TAG_Char('-'), variable1) /*HashMap::[]=*/;
131 variable1 = NEW_string___String___with_native(BOX_NativeString("star"), TAG_Int(4)); /*new String*/
132 ((hash___HashMap_____braeq_t)CALL( variable0 /*res*/,COLOR_abstract_collection___Map_____braeq))( variable0 /*res*/, TAG_Char('*'), variable1) /*HashMap::[]=*/;
133 variable1 = NEW_string___String___with_native(BOX_NativeString("slash"), TAG_Int(5)); /*new String*/
134 ((hash___HashMap_____braeq_t)CALL( variable0 /*res*/,COLOR_abstract_collection___Map_____braeq))( variable0 /*res*/, TAG_Char('/'), variable1) /*HashMap::[]=*/;
135 variable1 = NEW_string___String___with_native(BOX_NativeString("percent"), TAG_Int(7)); /*new String*/
136 ((hash___HashMap_____braeq_t)CALL( variable0 /*res*/,COLOR_abstract_collection___Map_____braeq))( variable0 /*res*/, TAG_Char('%'), variable1) /*HashMap::[]=*/;
137 variable1 = NEW_string___String___with_native(BOX_NativeString("bra"), TAG_Int(3)); /*new String*/
138 ((hash___HashMap_____braeq_t)CALL( variable0 /*res*/,COLOR_abstract_collection___Map_____braeq))( variable0 /*res*/, TAG_Char('['), variable1) /*HashMap::[]=*/;
139 variable1 = NEW_string___String___with_native(BOX_NativeString("eq"), TAG_Int(2)); /*new String*/
140 ((hash___HashMap_____braeq_t)CALL( variable0 /*res*/,COLOR_abstract_collection___Map_____braeq))( variable0 /*res*/, TAG_Char('='), variable1) /*HashMap::[]=*/;
141 variable1 = NEW_string___String___with_native(BOX_NativeString("l"), TAG_Int(1)); /*new String*/
142 ((hash___HashMap_____braeq_t)CALL( variable0 /*res*/,COLOR_abstract_collection___Map_____braeq))( variable0 /*res*/, TAG_Char('<'), variable1) /*HashMap::[]=*/;
143 variable1 = NEW_string___String___with_native(BOX_NativeString("g"), TAG_Int(1)); /*new String*/
144 ((hash___HashMap_____braeq_t)CALL( variable0 /*res*/,COLOR_abstract_collection___Map_____braeq))( variable0 /*res*/, TAG_Char('>'), variable1) /*HashMap::[]=*/;
145 variable1 = NEW_string___String___with_native(BOX_NativeString("n"), TAG_Int(1)); /*new String*/
146 ((hash___HashMap_____braeq_t)CALL( variable0 /*res*/,COLOR_abstract_collection___Map_____braeq))( variable0 /*res*/, TAG_Char('!'), variable1) /*HashMap::[]=*/;
147 variable1 = NEW_string___String___with_native(BOX_NativeString("u"), TAG_Int(1)); /*new String*/
148 ((hash___HashMap_____braeq_t)CALL( variable0 /*res*/,COLOR_abstract_collection___Map_____braeq))( variable0 /*res*/, TAG_Char('_'), variable1) /*HashMap::[]=*/;
149 variable1 = NEW_string___String___with_native(BOX_NativeString("at"), TAG_Int(2)); /*new String*/
150 ((hash___HashMap_____braeq_t)CALL( variable0 /*res*/,COLOR_abstract_collection___Map_____braeq))( variable0 /*res*/, TAG_Char('@'), variable1) /*HashMap::[]=*/;
151 variable0 = variable0 /*res*/;
152 goto return_label4;
153 return_label4: while(false);
154 tracehead = trace.prev;
155 return variable0;
156 }