Commit 2871eaac authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add Enumerated types support to write(ln)

Upgraded to version 1.1.0 due to the new feature
parent 44526062
......@@ -148,6 +148,9 @@ The fonts are the fonts from Ubuntu, check licence in file FONT-LICENSE.TXT
Changelog
=========
1.1.0 (07/2015)
- Write/Writeln procedure support enumerated types
1.0.1 (06/2015)
- Bugfix: use mono when calling asn1.exe by default (needed redhat-based
distros)
......
......@@ -709,6 +709,10 @@ def write_statement(param, newline):
elif type_kind == 'BooleanType':
cast = 'Boolean'
code.append(u"Put({cast}'Image({s}));".format(cast=cast, s=string))
elif type_kind == 'EnumeratedType':
code, string, local = expression(param)
code.append(u"Put({}'Image({}));".format(type_name(param.exprType),
string))
else:
error = (u'Unsupported parameter in write call ' +
param.inputString)
......
......@@ -465,7 +465,8 @@ def check_call(name, params, context):
if name.lower() in ('write', 'writeln'):
for p in params:
p_ty = p.exprType
if is_numeric(p_ty) or is_boolean(p_ty) or is_string(p_ty):
if is_numeric(p_ty) or is_boolean(p_ty) or is_string(p_ty) or \
is_enumerated(p_ty):
continue
raise TypeError('Type {} not supported in call to {}'.
format(type_name(p.exprType), name))
......
......@@ -115,7 +115,7 @@ except ImportError:
__all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse']
__version__ = '1.0.1'
__version__ = '1.1.0'
if hasattr(sys, 'frozen'):
# Detect if we are running on Windows (py2exe-generated)
......
......@@ -30,15 +30,6 @@ external comment '#vdm #classname=RemoteCall';
START;
/* CIF NEXTSTATE (944, 201), (72, 34) */
NEXTSTATE Wait;
/* CIF STATE (1474, 345), (74, 35) */
STATE next;
/* CIF INPUT (1447, 400), (122, 35) */
INPUT pulse(a);
/* CIF PROCEDURECALL (1401, 450), (213, 35) */
CALL reset_timer(mytimer);
/* CIF NEXTSTATE (1473, 500), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
/* CIF STATE (1468, 125), (100, 35) */
STATE timeout;
/* CIF INPUT (1453, 180), (147, 35) */
......@@ -48,6 +39,15 @@ external comment '#vdm #classname=RemoteCall';
/* CIF NEXTSTATE (1489, 280), (74, 35) */
NEXTSTATE next;
ENDSTATE;
/* CIF STATE (1474, 345), (74, 35) */
STATE next;
/* CIF INPUT (1447, 400), (122, 35) */
INPUT pulse(a);
/* CIF PROCEDURECALL (1401, 450), (213, 35) */
CALL reset_timer(mytimer);
/* CIF NEXTSTATE (1473, 500), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
/* CIF STATE (944, 201), (72, 34) */
STATE Wait;
/* CIF INPUT (666, 255), (101, 35) */
......@@ -79,8 +79,8 @@ anint := 478;
CALL writeln('Calling VDM2 with value', fixed(0));
/* CIF PROCEDURECALL (595, 946), (242, 35) */
CALL vdm2(fixed(0), simpleseq);
/* CIF PROCEDURECALL (521, 996), (391, 40) */
CALL writeln('Result:', simpleseq!a, ' ', simpleseq!b);
/* CIF PROCEDURECALL (461, 996), (511, 40) */
CALL writeln('Result:', simpleseq!a, ' ', simpleseq!b, ' ', simpleseq!c);
/* CIF OUTPUT (647, 1051), (138, 35) */
OUTPUT telemetry(a);
/* CIF OUTPUT (643, 1101), (147, 35) */
......
Markdown is supported
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