File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 12
12
#include < util/std_expr.h>
13
13
#include < util/symbol.h>
14
14
#include < util/hash_cont.h>
15
+ #include < util/arith_tools.h>
15
16
16
17
#include < ansi-c/expr2c_class.h>
17
18
@@ -239,6 +240,39 @@ std::string expr2javat::convert_constant(
239
240
if (src.is_zero ())
240
241
return " null" ;
241
242
}
243
+ else if (src.type ()==java_char_type ())
244
+ {
245
+ std::string dest;
246
+ dest.reserve (10 );
247
+
248
+ mp_integer int_value;
249
+ to_integer (src, int_value);
250
+
251
+ dest+=' \' ' ;
252
+
253
+ if (int_value>=' ' && int_value<127 )
254
+ dest+=(char )(int_value.to_long ());
255
+ else
256
+ {
257
+ std::string hex=integer2string (int_value, 16 );
258
+ while (hex.size ()<4 ) hex=' 0' +hex;
259
+ dest+=' \\ ' ;
260
+ dest+=' u' ;
261
+ dest+=hex;
262
+ }
263
+
264
+ dest+=' \' ' ;
265
+ return dest;
266
+ }
267
+ else if (src.type ()==java_long_type ())
268
+ {
269
+ // long integer literals must have 'L' at the end
270
+ mp_integer int_value;
271
+ to_integer (src, int_value);
272
+ std::string dest=integer2string (int_value);
273
+ dest+=' L' ;
274
+ return dest;
275
+ }
242
276
243
277
return expr2ct::convert_constant (src, precedence);
244
278
}
You can’t perform that action at this time.
0 commit comments