new c_src
[nit.git] / c_src / utils._sep.c
1 /* This C file is generated by NIT to compile module utils. */
2 #include "utils._sep.h"
3 val_t utils___Object___cmangle(val_t self, val_t param0) {
4 struct trace_t trace = {NULL, NULL, 21, LOCATE_utils___Object___cmangle};
5 static val_t once_value_1; static int once_bool_1; /* Once value for variable[4]*/
6 val_t variable[17];
7 void **closurevariable = NULL;
8 trace.prev = tracehead; tracehead = &trace;
9 trace.file = LOCATE_utils;
10 variable[0] = self;
11 /* check if p<Array[Symbol] with p:Symbol */
12 if (( param0!=NIT_NULL) && !VAL_ISA( param0, COLOR_Array, ID_Array)) { fprintf(stderr, "Cast failled"); fprintf(stderr, " in %s (%s:%d)\n", LOCATE_utils___Object___cmangle, LOCATE_utils, 22); nit_exit(1); } /*cast Array[Symbol]*/;
13 variable[1] = param0;
14 if (once_bool_1) variable[4] = once_value_1;
15 else {
16 variable[4] = variable[0];
17 variable[4] = CALL_utils___Object___cmangle_table(variable[4])(variable[4]) /*Object::cmangle_table*/;
18 once_value_1 = variable[4];
19 once_bool_1 = true;
20 }
21 variable[3] = variable[4];
22 variable[5] = NEW_String_string___String___init(); /*new String*/
23 variable[4] = variable[5];
24 variable[5] = CALL_abstract_collection___Collection___iterator( variable[1] /*symbols*/)( variable[1] /*symbols*/) /*AbstractArray::iterator*/;
25 while (true) { /*for*/
26 variable[6] = CALL_abstract_collection___Iterator___is_ok(variable[5])(variable[5]) /*ArrayIterator::is_ok*/;
27 if (!UNTAG_Bool(variable[6])) break; /*for*/
28 variable[6] = CALL_abstract_collection___Iterator___item(variable[5])(variable[5]) /*ArrayIterator::item*/;
29 variable[7] = variable[6];
30 variable[8] = CALL_abstract_collection___Collection___is_empty( variable[4] /*res*/)( variable[4] /*res*/) /*AbstractArray::is_empty*/;
31 if (UNTAG_Bool( TAG_Bool(!UNTAG_Bool(variable[8])))) { /*if*/
32 CALL_abstract_collection___SimpleCollection___add( variable[4] /*res*/)( variable[4] /*res*/, TAG_Char('_')) /*String::add*/;
33 CALL_abstract_collection___SimpleCollection___add( variable[4] /*res*/)( variable[4] /*res*/, TAG_Char('_')) /*String::add*/;
34 CALL_abstract_collection___SimpleCollection___add( variable[4] /*res*/)( variable[4] /*res*/, TAG_Char('_')) /*String::add*/;
35 }
36 variable[8] = TAG_Bool(false);
37 variable[9] = TAG_Bool(true);
38 variable[11] = CALL_string___Object___to_s( variable[7] /*sym*/)( variable[7] /*sym*/) /*Symbol::to_s*/;
39 variable[10] = variable[11];
40 variable[11] = CALL_abstract_collection___Collection___iterator( variable[10] /*s*/)( variable[10] /*s*/) /*AbstractArray::iterator*/;
41 while (true) { /*for*/
42 variable[12] = CALL_abstract_collection___Iterator___is_ok(variable[11])(variable[11]) /*ArrayIterator::is_ok*/;
43 if (!UNTAG_Bool(variable[12])) break; /*for*/
44 variable[12] = CALL_abstract_collection___Iterator___item(variable[11])(variable[11]) /*ArrayIterator::item*/;
45 variable[13] = variable[12];
46 variable[14] = TAG_Bool(UNTAG_Char( variable[13] /*c*/)>=UNTAG_Char( TAG_Char('a')));
47 variable[15] = variable[14];
48 if (UNTAG_Bool(variable[15])) { /* and */
49 variable[15] = TAG_Bool(UNTAG_Char( variable[13] /*c*/)<=UNTAG_Char( TAG_Char('z')));
50 }
51 variable[14] = variable[15];
52 variable[15] = variable[14];
53 if (!UNTAG_Bool(variable[15])) { /* or */
54 variable[15] = TAG_Bool(UNTAG_Char( variable[13] /*c*/)>=UNTAG_Char( TAG_Char('A')));
55 variable[16] = variable[15];
56 if (UNTAG_Bool(variable[16])) { /* and */
57 variable[16] = TAG_Bool(UNTAG_Char( variable[13] /*c*/)<=UNTAG_Char( TAG_Char('Z')));
58 }
59 variable[15] = variable[16];
60 }
61 variable[14] = variable[15];
62 variable[15] = variable[14];
63 if (!UNTAG_Bool(variable[15])) { /* or */
64 variable[15] = TAG_Bool(UNTAG_Char( variable[13] /*c*/)>=UNTAG_Char( TAG_Char('0')));
65 variable[16] = variable[15];
66 if (UNTAG_Bool(variable[16])) { /* and */
67 variable[16] = TAG_Bool(UNTAG_Char( variable[13] /*c*/)<=UNTAG_Char( TAG_Char('9')));
68 }
69 variable[15] = variable[16];
70 }
71 variable[14] = variable[15];
72 if (UNTAG_Bool(variable[14])) { /*if*/
73 CALL_abstract_collection___SimpleCollection___add( variable[4] /*res*/)( variable[4] /*res*/, variable[13] /*c*/) /*String::add*/;
74 variable[8] = TAG_Bool(false) /*underscore=*/;
75 variable[9] = TAG_Bool(true) /*normal=*/;
76 } else { /*if*/
77 variable[14] = TAG_Bool(( variable[13] /*c*/)==( TAG_Char('_')));
78 variable[15] = variable[14];
79 if (UNTAG_Bool(variable[15])) { /* and */
80 variable[15] = TAG_Bool(!UNTAG_Bool( variable[8] /*underscore*/));
81 }
82 variable[14] = variable[15];
83 if (UNTAG_Bool(variable[14])) { /*if*/
84 CALL_abstract_collection___SimpleCollection___add( variable[4] /*res*/)( variable[4] /*res*/, variable[13] /*c*/) /*String::add*/;
85 variable[8] = TAG_Bool(true) /*underscore=*/;
86 variable[9] = TAG_Bool(true) /*normal=*/;
87 } else { /*if*/
88 variable[14] = CALL_abstract_collection___Map___has_key( variable[3] /*table*/)( variable[3] /*table*/, variable[13] /*c*/) /*CoupleMap::has_key*/;
89 if (UNTAG_Bool(variable[14])) { /*if*/
90 if (UNTAG_Bool( variable[9] /*normal*/)) { /*if*/
91 CALL_abstract_collection___SimpleCollection___add( variable[4] /*res*/)( variable[4] /*res*/, TAG_Char('_')) /*String::add*/;
92 CALL_abstract_collection___SimpleCollection___add( variable[4] /*res*/)( variable[4] /*res*/, TAG_Char('_')) /*String::add*/;
93 }
94 variable[14] = CALL_abstract_collection___Map_____bra( variable[3] /*table*/)( variable[3] /*table*/, variable[13] /*c*/) /*CoupleMap::[]*/;
95 CALL_abstract_collection___IndexedCollection___append( variable[4] /*res*/)( variable[4] /*res*/, variable[14]) /*String::append*/;
96 variable[9] = TAG_Bool(false) /*normal=*/;
97 variable[8] = TAG_Bool(false) /*underscore=*/;
98 }
99 }
100 }
101 continue_3: while(0);
102 CALL_abstract_collection___Iterator___next(variable[11])(variable[11]) /*ArrayIterator::next*/;
103 }
104 break_3: while(0);
105 continue_2: while(0);
106 CALL_abstract_collection___Iterator___next(variable[5])(variable[5]) /*ArrayIterator::next*/;
107 }
108 break_2: while(0);
109 variable[2] = variable[4] /*res*/;
110 goto return_label0;
111 return_label0: while(false);
112 tracehead = trace.prev;
113 return variable[2];
114 }
115 val_t utils___Object___cmangle_table(val_t self) {
116 struct trace_t trace = {NULL, NULL, 58, LOCATE_utils___Object___cmangle_table};
117 val_t variable[4];
118 void **closurevariable = NULL;
119 trace.prev = tracehead; tracehead = &trace;
120 trace.file = LOCATE_utils;
121 variable[0] = self;
122 variable[3] = NEW_HashMap_hash___HashMap___init(); /*new HashMap[Char, String]*/
123 variable[2] = variable[3];
124 variable[3] = NEW_String_string___String___with_native(BOX_NativeString("plus"), TAG_Int(4)); /*new String*/
125 CALL_abstract_collection___Map_____braeq( variable[2] /*res*/)( variable[2] /*res*/, TAG_Char('+'), variable[3]) /*HashMap::[]=*/;
126 variable[3] = NEW_String_string___String___with_native(BOX_NativeString("minus"), TAG_Int(5)); /*new String*/
127 CALL_abstract_collection___Map_____braeq( variable[2] /*res*/)( variable[2] /*res*/, TAG_Char('-'), variable[3]) /*HashMap::[]=*/;
128 variable[3] = NEW_String_string___String___with_native(BOX_NativeString("star"), TAG_Int(4)); /*new String*/
129 CALL_abstract_collection___Map_____braeq( variable[2] /*res*/)( variable[2] /*res*/, TAG_Char('*'), variable[3]) /*HashMap::[]=*/;
130 variable[3] = NEW_String_string___String___with_native(BOX_NativeString("slash"), TAG_Int(5)); /*new String*/
131 CALL_abstract_collection___Map_____braeq( variable[2] /*res*/)( variable[2] /*res*/, TAG_Char('/'), variable[3]) /*HashMap::[]=*/;
132 variable[3] = NEW_String_string___String___with_native(BOX_NativeString("percent"), TAG_Int(7)); /*new String*/
133 CALL_abstract_collection___Map_____braeq( variable[2] /*res*/)( variable[2] /*res*/, TAG_Char('%'), variable[3]) /*HashMap::[]=*/;
134 variable[3] = NEW_String_string___String___with_native(BOX_NativeString("bra"), TAG_Int(3)); /*new String*/
135 CALL_abstract_collection___Map_____braeq( variable[2] /*res*/)( variable[2] /*res*/, TAG_Char('['), variable[3]) /*HashMap::[]=*/;
136 variable[3] = NEW_String_string___String___with_native(BOX_NativeString("eq"), TAG_Int(2)); /*new String*/
137 CALL_abstract_collection___Map_____braeq( variable[2] /*res*/)( variable[2] /*res*/, TAG_Char('='), variable[3]) /*HashMap::[]=*/;
138 variable[3] = NEW_String_string___String___with_native(BOX_NativeString("l"), TAG_Int(1)); /*new String*/
139 CALL_abstract_collection___Map_____braeq( variable[2] /*res*/)( variable[2] /*res*/, TAG_Char('<'), variable[3]) /*HashMap::[]=*/;
140 variable[3] = NEW_String_string___String___with_native(BOX_NativeString("g"), TAG_Int(1)); /*new String*/
141 CALL_abstract_collection___Map_____braeq( variable[2] /*res*/)( variable[2] /*res*/, TAG_Char('>'), variable[3]) /*HashMap::[]=*/;
142 variable[3] = NEW_String_string___String___with_native(BOX_NativeString("n"), TAG_Int(1)); /*new String*/
143 CALL_abstract_collection___Map_____braeq( variable[2] /*res*/)( variable[2] /*res*/, TAG_Char('!'), variable[3]) /*HashMap::[]=*/;
144 variable[3] = NEW_String_string___String___with_native(BOX_NativeString("u"), TAG_Int(1)); /*new String*/
145 CALL_abstract_collection___Map_____braeq( variable[2] /*res*/)( variable[2] /*res*/, TAG_Char('_'), variable[3]) /*HashMap::[]=*/;
146 variable[3] = NEW_String_string___String___with_native(BOX_NativeString("at"), TAG_Int(2)); /*new String*/
147 CALL_abstract_collection___Map_____braeq( variable[2] /*res*/)( variable[2] /*res*/, TAG_Char('@'), variable[3]) /*HashMap::[]=*/;
148 variable[1] = variable[2] /*res*/;
149 goto return_label4;
150 return_label4: while(false);
151 tracehead = trace.prev;
152 return variable[1];
153 }