Commit f78c9c29 authored by Maxime Perrotin's avatar Maxime Perrotin
parents c61b28f5 66766fa9
......@@ -135,6 +135,13 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
2.0.40 (04/2019)
- Improve generated gpr file
2.0.39 (04/2019)
- Fix append operator when using substrings
- Fix unicode issue
2.0.38 (04/2019)
- Support advanced "in" expressions (e.g. "someVar in {enum1, enum2}",
or "someVar in {{a 4, b false}, {a 1, b true}}"
......
......@@ -264,7 +264,7 @@ end {pr}_Lib;'''.format(pr=process_name.lower(),
# Create a .gpr to build the Ada generated code
ada_gpr = '''project {pr}_Ada is
for Languages use ("Ada");
for Source_Dirs use (".");
for Source_Dirs use (".") & External_As_List ("CODE_PATH", ":");
for Object_Dir use "obj";
end {pr}_Ada;'''.format(pr=process_name.lower())
......@@ -2265,7 +2265,7 @@ def _append(expr, **kwargs):
# print " Right range = ", expr.right.exprType.Max
if not self_standing:
right = "{sort}_Array'({right}, others => <>)(1 .. {rMax})".format(
right = u"{sort}_Array'({right}, others => <>)(1 .. {rMax})".format(
right=right,
sort=name_of_type,
rMax=expr.right.exprType.Max)
......@@ -3100,7 +3100,10 @@ def append_size(append):
else:
# Must be a variable of type SEQOF
_, inner, _ = expression(each, readonly=1)
result += u'{}.Length'.format(inner)
if isinstance (each, ogAST.PrimSubstring):
result += u"{}'Length".format(inner)
else:
result += u"{}.Length".format(inner)
return result
......
......@@ -141,7 +141,7 @@ except ImportError:
__all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse']
__version__ = '2.0.38'
__version__ = '2.0.40'
if hasattr(sys, 'frozen'):
# Detect if we are running on Windows (py2exe-generated)
......
......@@ -7,6 +7,8 @@
**/tmp/
**/build/
*/code/
*/GPS_project.gpr
*/*generated
*/generated*
*/*.adb
......
include ../shared.mk
ROOT_MODEL=og.pr
all: test-ada test-llvm
edit:
$(OPENGEODE) og.pr
test-parse:
$(OPENGEODE) og.pr --check
test-qgen-parse:
$(TESTQGEN_PARSE) $(ROOT_MODEL)
test-qgen-ada:
$(TESTQGEN_ADA) $(ROOT_MODEL)
test-qgen-c:
$(TESTQGEN_C) $(ROOT_MODEL)
test-qgen-gt-ada:
$(TESTQGEN_GT_ADA) $(ROOT_MODEL)
test-qgen-gt-c:
$(TESTQGEN_GT_C) $(ROOT_MODEL)
test-ada:
make -f Makefile.og
test-c:
$(OPENGEODE) og.pr --toC
mono $(ASN1SCC) -c -typePrefix asn1Scc -equal dataview-uniq.asn
$(CC) -O$(O) -c *.c
test-llvm:
$(OPENGEODE) og.pr --llvm -O$(O)
$(LLC) *.ll
$(CC) -O$(O) -c *.s
coverage:
coverage run -p $(OPENGEODE) og.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
all:
gprbuild -p -P og.gpr # generate Ada code from the SDL model
gprbuild -p -P dataview_ada.gpr # generate Ada code from the ASN.1 model
gprbuild -p -P code/og_ada.gpr # build the Ada code
clean:
rm -rf obj code
\ No newline at end of file
TASTE-Dataview DEFINITIONS ::=
BEGIN
MyChoice ::= CHOICE {
a CHOICE {
b CHOICE {
c BOOLEAN,
d BOOLEAN
},
e BOOLEAN
},
f BOOLEAN
}
Some-Thing ::= MyInteger
MyInteger ::= INTEGER (0..255)
My-OctStr ::= OCTET STRING (SIZE (0..20))
SeqOf ::= SEQUENCE (SIZE(0..100)) OF MyInteger
Type1 ::= INTEGER(0..1)
Type2 ::= BOOLEAN
Toto ::= SEQUENCE { elem-1 Type1, elem-2 Type2 }
SeqBool ::= SEQUENCE(SIZE(1..5)) OF BOOLEAN
Enum-T ::= ENUMERATED {enum1, enum2, enum3}
ForTheSakeOfIt ::= SEQUENCE (SIZE (2)) OF Enum-T
default-seqof SeqOf ::= {4,7,9}
default-str My-OctStr ::= 'DEADBEEF'H
END
project DataView_Ada is
for Languages use ("ASN1");
for Source_Dirs use (".");
for Source_Files use ("dataview-uniq.asn");
for Object_Dir use "code";
package Naming is
for Body_Suffix ("ASN1") use ".asn";
end Naming;
package Compiler is
for Driver ("ASN1") use "asn1.exe";
for Leading_Required_Switches ("ASN1") use ("-Ada", "-typePrefix", "Asn1Scc");
end Compiler;
end DataView_Ada;
\ No newline at end of file
project DataView_c is
for Languages use ("ASN1");
for Source_Dirs use (".");
for Source_Files use ("dataview-uniq.asn");
for Object_Dir use "code";
package Naming is
for Body_Suffix ("ASN1") use ".asn";
end Naming;
package Compiler is
for Driver ("ASN1") use "asn1.exe";
for Leading_Required_Switches ("ASN1") use ("-c", "-typePrefix", "Asn1Scc");
end Compiler;
end DataView_c;
\ No newline at end of file
project og is
for Languages use ("SDL");
for Source_Dirs use (".");
for Object_Dir use "code";
for Source_Files use ("og.pr");
package Naming is
for Body_Suffix ("SDL") use ".pr";
end Naming;
package Compiler is
for Driver ("SDL") use "opengeode";
for Object_File_Suffix ("SDL") use ".adb";
for Leading_Required_Switches ("SDL") use ("--toAda");
end Compiler;
end og;
\ No newline at end of file
system og;
/* CIF TEXT (159, 221), (290, 200) */
-- Text area for declarations and comments
use dv comment 'dataview-uniq.asn';
--use dv2 comment 'dataview2.asn';
signal dd(Type2);
signal we(Some_Thing);
procedure hehe;
fpar in/out a_param Type2;
external;
/* CIF ENDTEXT */
channel c
from env to og with dd;
from og to env with we;
endchannel;
block og;
signalroute r
from env to og with dd;
from og to env with we;
connect c and r;
/* CIF PROCESS (225, 49), (150, 75) */
process og;
/* CIF TEXT (74, 125), (321, 173) */
dcl foo, bar SeqBool;
dcl idx myinteger := 3;
/* CIF ENDTEXT */
/* CIF START (556, 221), (70, 35) */
START;
/* CIF task (470, 276), (242, 38) */
task foo := { true, false},
bar := {false, true, true, false, false};
/* CIF task (503, 334), (176, 35) */
task foo := foo // bar (0, idx );
/* CIF NEXTSTATE (556, 384), (70, 35) */
NEXTSTATE wait;
/* CIF state (826, 332), (70, 35) */
state wait;
endstate;
endprocess og;
endblock;
endsystem;
\ No newline at end of file
[General]
geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\x1_\0\0\0\0\0\0\a\x7f\0\0\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2\0\0\0\x1\xfc\0\0\0\x35\0\0\x2\x99\0\0\0y\x1\0\0\x15\xfa\0\0\0\0\x2\0\0\0\x2\xfb\0\0\0\x1c\0\x64\0\x61\0t\0\x61\0t\0y\0p\0\x65\0s\0_\0\x64\0o\0\x63\0k\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\x63\0\xff\xff\xff\xfb\0\0\0\x1a\0\x64\0\x61\0t\0\x61\0\x64\0i\0\x63\0t\0_\0\x64\0o\0\x63\0k\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\x63\0\xff\xff\xff\0\0\0\x3\0\0\x5\xef\0\0\0\x8c\xfc\x1\0\0\0\x1\xfb\0\0\0\xe\0m\0s\0g\0\x44\0o\0\x63\0k\x1\0\0\0.\0\0\x5\xef\0\0\0\x46\0\a\xff\xff\0\0\x3\xbd\0\0\x2\x99\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x2\0\0\0\0\0\0\0\x1\0\0\0\x16\0S\0\x44\0L\0 \0T\0o\0o\0l\0\x62\0\x61\0r\x3\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x2\0\0\0\x1\0\0\0\x18\0\x46\0i\0l\0\x65\0 \0T\0o\0o\0l\0\x62\0\x61\0r\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0)"
project og_Ada is
for Languages use ("Ada");
for Source_Dirs use (".");
for Object_Dir use "obj";
end og_Ada;
\ No newline at end of file
......@@ -45,10 +45,10 @@ system og;
call writeln('OK 1');
/* CIF ANSWER (601, 396), (70, 23) */
(false):
/* CIF PROCEDURECALL (568, 439), (135, 35) */
/* CIF PROCEDURECALL (568, 439), (136, 35) */
call writeln('ERROR 1');
enddecision;
/* CIF decision (544, 489), (93, 50) */
/* CIF decision (543, 489), (95, 50) */
decision 3 in {1,2,3,4};
/* CIF ANSWER (478, 559), (70, 23) */
(true):
......@@ -59,7 +59,7 @@ system og;
/* CIF PROCEDURECALL (576, 602), (142, 35) */
call writeln('ERROR 2');
enddecision;
/* CIF decision (491, 652), (200, 50) */
/* CIF decision (488, 652), (206, 50) */
decision someEnum in {enum1, enum2};
/* CIF ANSWER (475, 722), (70, 23) */
(true):
......@@ -70,20 +70,18 @@ system og;
/* CIF PROCEDURECALL (579, 765), (142, 35) */
call writeln('ERROR 3');
enddecision;
/* CIF decision (388, 815), (406, 50) */
decision someSeq in {{elem_1 1, elem_2 false}, {elem_1 0, elem_2 true}}
/* CIF comment (814, 822), (226, 35) */
comment 'cause bug in Ada backend: FIXME';
/* CIF ANSWER (475, 885), (70, 23) */
/* CIF decision (388, 815), (406, 187) */
decision someSeq in {{elem_1 1, elem_2 false}, {elem_1 0, elem_2 true}};
/* CIF ANSWER (475, 1029), (70, 23) */
(true):
/* CIF PROCEDURECALL (450, 928), (119, 35) */
/* CIF PROCEDURECALL (450, 1072), (119, 35) */
call writeln('OK 5');
/* CIF ANSWER (615, 885), (70, 23) */
/* CIF ANSWER (615, 1029), (70, 23) */
(false):
/* CIF PROCEDURECALL (579, 928), (142, 35) */
/* CIF PROCEDURECALL (579, 1072), (142, 35) */
call writeln('ERROR 5');
enddecision;
/* CIF NEXTSTATE (556, 978), (70, 35) */
/* CIF NEXTSTATE (556, 1126), (70, 35) */
NEXTSTATE wait;
/* CIF state (826, 332), (70, 35) */
state wait;
......
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