Commit e0cc051b authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix additional issues with string handling in LLVM

parent aa4912c2
......@@ -2175,7 +2175,11 @@ def sdl_write(arg_vals, arg_asn1tys, ctx, newline=False):
elif basic_asn1ty.kind in ('StringType', 'StandardStringType'):
fmt += '%s'
arg_values.append(arg_val)
if isinstance(arg_val, SDLStringLiteral):
arr_ptr = ctx.string_ptr(arg_val.string)
arg_values.append(arr_ptr)
else:
arg_values.append(arg_val)
elif basic_asn1ty.kind == 'OctetStringType':
fmt += '%.*s'
......@@ -2183,6 +2187,9 @@ def sdl_write(arg_vals, arg_asn1tys, ctx, newline=False):
if isinstance(arg_val, SDLSubstringValue):
arr_ptr = arg_val.arr_ptr
count_val = arg_val.count_val
elif isinstance(arg_val, SDLStringLiteral):
arr_ptr = ctx.string_ptr(arg_val.string)
count_val = lc.Constant.int(ctx.i32, int(arg_val.length))
elif basic_asn1ty.Min == basic_asn1ty.Max:
arr_ptr = ctx.builder.gep(arg_val, [ctx.zero, ctx.zero])
count_val = lc.Constant.int(ctx.i32, arr_ptr.type.pointee.count)
......
......@@ -16,13 +16,17 @@ dcl variable variableString := 'Hop';
FIXME: string world
cannot be longer than
6 chars ! ';
/* CIF PROCEDURECALL (410, 210), (162, 35) */
/* CIF PROCEDURECALL (357, 210), (267, 35) */
CALL writeln(fixed(0,2)//fixed(2,3)// ' word');
/* CIF PROCEDURECALL (410, 260), (162, 35) */
CALL writeln(variable);
/* CIF TASK (397, 260), (188, 35) */
/* CIF TASK (397, 310), (188, 35) */
TASK variable := variable // '!!';
/* CIF PROCEDURECALL (410, 310), (162, 35) */
/* CIF PROCEDURECALL (410, 360), (162, 35) */
CALL writeln(variable);
/* CIF NEXTSTATE (456, 360), (70, 35) */
/* CIF PROCEDURECALL (406, 410), (170, 35) */
CALL writeln(variable//':-)');
/* CIF NEXTSTATE (456, 460), (70, 35) */
NEXTSTATE wait;
/* CIF STATE (272, 359), (70, 35) */
STATE wait;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment