Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenGEODE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
TASTE
OpenGEODE
Commits
bff5c216
Commit
bff5c216
authored
Oct 06, 2020
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Plain Diff
Merge
https://github.com/esa/opengeode
into python3-pyside2
parents
299496c6
695736e3
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
199 additions
and
186 deletions
+199
-186
README.md
README.md
+3
-0
opengeode/AdaGenerator.py
opengeode/AdaGenerator.py
+175
-175
opengeode/Asn1scc.py
opengeode/Asn1scc.py
+4
-2
opengeode/ogParser.py
opengeode/ogParser.py
+11
-4
opengeode/opengeode.py
opengeode/opengeode.py
+1
-1
tests/testsuite/test-choice-determinant/expected
tests/testsuite/test-choice-determinant/expected
+2
-2
tests/testsuite/test-simu/Makefile
tests/testsuite/test-simu/Makefile
+1
-0
tests/testsuite/test-simu/test_ada.c
tests/testsuite/test-simu/test_ada.c
+2
-2
No files found.
README.md
View file @
bff5c216
...
...
@@ -142,6 +142,9 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
**3.3.3 (10/2020)**
-
Refactoring : Generate all data types in ASN.1
**3.3.2 (10/2020)**
-
Fix reporting of semantic errors in procedures
...
...
opengeode/AdaGenerator.py
View file @
bff5c216
This diff is collapsed.
Click to expand it.
opengeode/Asn1scc.py
View file @
bff5c216
...
...
@@ -201,13 +201,15 @@ def create_choice_determinant_types(ast):
"Line"
:
each
.
Line
,
"CharPositionInLine"
:
each
.
CharPositionInLine
,
"EnumID"
:
each
.
type
.
Children
[
key
].
EnumID
,
"IsStandardEnum"
:
False
#
"IsStandardEnum" : False
})
for
key
in
each
.
type
.
Children
.
keys
()
}
new_sorts
[
new_sort
]
=
\
type
(
new_sort
,
(
object
,),
{
"Line"
:
each
.
Line
,
"CharPositionInLine"
:
each
.
CharPositionInLine
,
"AddedType"
:
"False"
,
"ChoiceTypeName"
:
each
.
__name__
,
"type"
:
type
(
new_sort
+
"_type"
,
(
object
,),
{
"Line"
:
each
.
Line
,
"CharPositionInLine"
:
each
.
CharPositionInLine
,
...
...
@@ -220,7 +222,7 @@ def create_choice_determinant_types(ast):
return
new_sorts
def
asn2dataModel
(
*
files
):
''' Call asn
1
DataModel, including the Makefile.python and return
''' Call asn
2
DataModel, including the Makefile.python and return
the imported module "name_of_dataview_asn.py"
From this module it is possible to create native Asn1scc instances of
ASN.1 data types, and to access to DV.py, which contains constants
...
...
opengeode/ogParser.py
View file @
bff5c216
...
...
@@ -179,6 +179,7 @@ lineno = lambda : currentframe().f_back.f_lineno
# they are stored in a dedicated dictionary with the same structure
# as the ASN1SCC generated python AST
USER_DEFINED_TYPES
=
dict
()
CHOICE_SELECTORS
=
dict
()
def
types
():
...
...
@@ -186,13 +187,13 @@ def types():
ret
=
getattr
(
DV
,
'types'
,
{}).
copy
()
ret
.
update
(
USER_DEFINED_TYPES
)
return
ret
#types = lambda: getattr(DV, 'types', {}) or USER_DEFINED_TYPES
def
set_global_DV
(
asn1_filenames
):
# type: (List[str]) -> None
''' Call ASN.1 parser and set the global dataview AST entry (DV) '''
global
DV
global
USER_DEFINED_TYPES
if
'--toC'
in
sys
.
argv
:
rename_policy
=
ASN1
.
RenameOnlyConflicting
else
:
...
...
@@ -205,7 +206,11 @@ def set_global_DV(asn1_filenames):
pretty_print
=
True
)
# Create new types corresponding to CHOICE determinants as enum
choice_selectors
=
create_choice_determinant_types
(
DV
)
DV
.
types
.
update
(
choice_selectors
)
# Add to user defined types, so that they wil be generated
# as explicit ASN.1 types
CHOICE_SELECTORS
.
update
(
choice_selectors
)
USER_DEFINED_TYPES
=
CHOICE_SELECTORS
.
copy
()
#DV.types.update(choice_selectors)
except
(
ImportError
,
NameError
)
as
err
:
# Can happen if DataView.py is not there
LOG
.
error
(
'Error loading ASN.1 model'
)
...
...
@@ -3151,6 +3156,7 @@ def get_array_type(newtypename, root):
newtype
=
type
(
str
(
newtypename
),
(
object
,),
{
"Line"
:
typeSortLine
,
"CharPositionInLine"
:
typeSortChar
,
"AddedType"
:
"False"
,
"type"
:
type
(
"SeqOf_type"
,
(
object
,),
{
"Line"
:
typeSortLine
,
"CharPositionInLine"
:
typeSortChar
,
...
...
@@ -3588,7 +3594,8 @@ def process_definition(root, parent=None, context=None):
inner_proc
=
[]
# first look for all text areas to find NEWTYPE declarations
USER_DEFINED_TYPES
.
clear
()
USER_DEFINED_TYPES
=
CHOICE_SELECTORS
.
copy
()
process
.
user_defined_types
=
USER_DEFINED_TYPES
tas
=
(
x
for
x
in
root
.
getChildren
()
if
x
.
type
==
lexer
.
TEXTAREA
)
for
child
in
tas
:
content
=
(
x
for
x
in
child
.
getChildren
()
...
...
@@ -5310,7 +5317,7 @@ def pr_file(root):
# This to allow SDL types injection in ASN1 ASTs
DV
=
type
(
"ASNParseTree"
,
(
object
,
),
{
"types"
:
{},
"exportedVariables"
:
{},
"asn1Modules"
:
[],
"variables"
:
{}})
"exportedTypes"
:
{},
"variables"
:
{}})
# Re-order the children of the AST to make sure system and use clauses
# are parsed before process definition - to get signal definitions
...
...
opengeode/opengeode.py
View file @
bff5c216
...
...
@@ -140,7 +140,7 @@ except ImportError:
__all__
=
[
'opengeode'
,
'SDL_Scene'
,
'SDL_View'
,
'parse'
]
__version__
=
'3.3.
2
'
__version__
=
'3.3.
3
'
if
hasattr
(
sys
,
'frozen'
):
# Detect if we are running on Windows (py2exe-generated)
...
...
tests/testsuite/test-choice-determinant/expected
View file @
bff5c216
num(det) = 0 (should be 0)
FOO_PRESENT (should be FOO)
ASN1SCC
FOO_PRESENT (should be FOO)
ASN1SCCFOO (should be FOO)
BAR_PRESENT (should be BAR)
ASN1SCC
BAR_PRESENT (should be BAR)
ASN1SCCBAR (should be BAR)
ASN1SCCFOO (should be FOO)
tests/testsuite/test-simu/Makefile
View file @
bff5c216
...
...
@@ -37,6 +37,7 @@ test-ada:
./test_ada
simu
:
rm
-rf
orchestrator_simu
$(OPENGEODE)
orchestrator.pr system_structure.pr
--shared
taste-properties
-s
properties orchestrator.pr system_structure.pr
make
-f
Makefile.properties
...
...
tests/testsuite/test-simu/test_ada.c
View file @
bff5c216
...
...
@@ -10,7 +10,7 @@ extern char *orchestrator_state();
void
orchestrator_RI_peek_list
(
void
*
_
)
{}
void
orchestrator_RI_peek_fixed
(
void
*
_
)
{}
void
orchestrator_RI_telemetry
(
void
*
_
){}
extern
char
*
fixed_value
();
//
extern char *fixed_value();
//extern int fixed_size();
int
main
()
{
...
...
@@ -20,7 +20,7 @@ int main()
printf
(
"[C Code] Running test
\n
"
);
adainit
();
orchestrator_startup
();
toto
=
fixed_value
();
//
toto = fixed_value();
printf
(
"%s
\n
"
,
orchestrator_state
());
orchestrator_PI_other
();
printf
(
"%s
\n
"
,
orchestrator_state
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment