Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
dmt
Commits
a51da808
Commit
a51da808
authored
Jun 22, 2016
by
Thanassis Tsiodras
Browse files
Added configuration file for flake8 pass, too
parent
8c985d5f
Changes
31
Hide whitespace changes
Inline
Side-by-side
.flake8
0 → 100644
View file @
a51da808
[flake8]
ignore = E501,E225,C103
max-line-length = 160
A_mappers/Stubs.py
View file @
a51da808
...
@@ -219,8 +219,8 @@ An example for SetLength:
...
@@ -219,8 +219,8 @@ An example for SetLength:
return
"Choose the information you want - whole-structure or sequence dump not supported."
return
"Choose the information you want - whole-structure or sequence dump not supported."
def
__getattr__
(
self
,
x
):
def
__getattr__
(
self
,
x
):
self
.
_Caccessor
+=
"_"
+
Clean
(
x
)
self
.
_Caccessor
+=
"_"
+
Clean
(
x
)
self
.
_accessPath
+=
"."
+
x
self
.
_accessPath
+=
"."
+
x
return
self
return
self
def
__setattr__
(
self
,
name
,
value
):
def
__setattr__
(
self
,
name
,
value
):
...
@@ -237,7 +237,7 @@ An example for SetLength:
...
@@ -237,7 +237,7 @@ An example for SetLength:
def
Get
(
self
,
**
args
):
# postfix="", reset=True
def
Get
(
self
,
**
args
):
# postfix="", reset=True
try
:
try
:
bridgeFuncName
=
Clean
(
self
.
_nodeTypeName
)
+
"_"
+
self
.
_Caccessor
+
"_Get"
+
args
.
get
(
"postfix"
,
""
)
bridgeFuncName
=
Clean
(
self
.
_nodeTypeName
)
+
"_"
+
self
.
_Caccessor
+
"_Get"
+
args
.
get
(
"postfix"
,
""
)
if
bridgeFuncName
not
in
DV_Types
.
funcTypeLookup
:
if
bridgeFuncName
not
in
DV_Types
.
funcTypeLookup
:
raise
AsnCoderError
(
"Function %s not found in lookup - contact support."
%
bridgeFuncName
)
raise
AsnCoderError
(
"Function %s not found in lookup - contact support."
%
bridgeFuncName
)
resType
=
DV_Types
.
funcTypeLookup
[
bridgeFuncName
]
resType
=
DV_Types
.
funcTypeLookup
[
bridgeFuncName
]
...
@@ -269,7 +269,7 @@ An example for SetLength:
...
@@ -269,7 +269,7 @@ An example for SetLength:
def
Set
(
self
,
value
,
**
args
):
# postfix="", reset=True
def
Set
(
self
,
value
,
**
args
):
# postfix="", reset=True
try
:
try
:
# print Clean(self._nodeTypeName) + "_" + self._Caccessor + "_Set"+postfix
# print Clean(self._nodeTypeName) + "_" + self._Caccessor + "_Set"+postfix
bridgeFunc
=
getattr
(
JMP
,
Clean
(
self
.
_nodeTypeName
)
+
"_"
+
self
.
_Caccessor
+
"_Set"
+
args
.
get
(
"postfix"
,
""
))
bridgeFunc
=
getattr
(
JMP
,
Clean
(
self
.
_nodeTypeName
)
+
"_"
+
self
.
_Caccessor
+
"_Set"
+
args
.
get
(
"postfix"
,
""
))
if
isinstance
(
value
,
float
):
if
isinstance
(
value
,
float
):
ctypesValue
=
c_double
(
value
)
ctypesValue
=
c_double
(
value
)
elif
isinstance
(
value
,
int
):
elif
isinstance
(
value
,
int
):
...
@@ -283,8 +283,9 @@ An example for SetLength:
...
@@ -283,8 +283,9 @@ An example for SetLength:
oldAP
=
self
.
_accessPath
oldAP
=
self
.
_accessPath
if
args
.
get
(
"reset"
,
True
):
if
args
.
get
(
"reset"
,
True
):
self
.
Reset
()
self
.
Reset
()
raise
AsnCoderError
(
"The access path you used (%s) or the value you tried to assign (%s) is not valid. %s"
%
raise
AsnCoderError
(
(
oldAP
,
str
(
value
),
str
(
e
)))
"The access path you used (%s) or the value you tried to assign (%s) is not valid. %s"
%
(
oldAP
,
str
(
value
),
str
(
e
)))
if
args
.
get
(
"reset"
,
True
):
if
args
.
get
(
"reset"
,
True
):
self
.
Reset
()
self
.
Reset
()
...
@@ -298,7 +299,7 @@ An example for SetLength:
...
@@ -298,7 +299,7 @@ An example for SetLength:
def
getErrCode
(
pErr
):
def
getErrCode
(
pErr
):
errCode
=
0
errCode
=
0
for
i
in
range
(
4
):
for
i
in
range
(
4
):
errCode
=
(
errCode
<<
8
)
|
GetBufferByte
(
pErr
,
(
3
-
i
))
errCode
=
(
errCode
<<
8
)
|
GetBufferByte
(
pErr
,
(
3
-
i
))
return
errCode
return
errCode
def
Encode
(
self
,
bitstream
,
bACN
=
False
):
def
Encode
(
self
,
bitstream
,
bACN
=
False
):
...
...
A_mappers/msgPrinter.py
View file @
a51da808
...
@@ -46,6 +46,7 @@ from commonPy.recursiveMapper import RecursiveMapper
...
@@ -46,6 +46,7 @@ from commonPy.recursiveMapper import RecursiveMapper
import
commonPy.verify
import
commonPy.verify
def
usage
():
def
usage
():
'''Print usage instructions.'''
'''Print usage instructions.'''
msg
=
'Usage: %s <options> input1.asn1 [input2.asn1]...
\n
Where options are:
\n
'
msg
=
'Usage: %s <options> input1.asn1 [input2.asn1]...
\n
Where options are:
\n
'
...
@@ -114,7 +115,7 @@ class Printer(RecursiveMapper):
...
@@ -114,7 +115,7 @@ class Printer(RecursiveMapper):
lines
.
append
(
lines
.
append
(
"%sif (%s.kind == %s) {"
%
"%sif (%s.kind == %s) {"
%
(
self
.
maybeElse
(
childNo
),
srcCVariable
,
self
.
CleanName
(
child
[
2
])))
(
self
.
maybeElse
(
childNo
),
srcCVariable
,
self
.
CleanName
(
child
[
2
])))
lines
.
extend
([
' '
+
x
lines
.
extend
([
' '
+
x
for
x
in
self
.
Map
(
for
x
in
self
.
Map
(
"%s.u.%s"
%
(
srcCVariable
,
self
.
CleanName
(
child
[
0
])),
"%s.u.%s"
%
(
srcCVariable
,
self
.
CleanName
(
child
[
0
])),
prefix
+
"::"
+
self
.
CleanName
(
child
[
0
]),
prefix
+
"::"
+
self
.
CleanName
(
child
[
0
]),
...
@@ -131,7 +132,7 @@ class Printer(RecursiveMapper):
...
@@ -131,7 +132,7 @@ class Printer(RecursiveMapper):
lines
.
append
(
" int i%s;"
%
uniqueId
)
lines
.
append
(
" int i%s;"
%
uniqueId
)
limit
=
sourceSequenceLimit
(
node
,
srcCVariable
)
limit
=
sourceSequenceLimit
(
node
,
srcCVariable
)
lines
.
append
(
" for(i%s=0; i%s<%s; i%s++) {"
%
(
uniqueId
,
uniqueId
,
limit
,
uniqueId
))
lines
.
append
(
" for(i%s=0; i%s<%s; i%s++) {"
%
(
uniqueId
,
uniqueId
,
limit
,
uniqueId
))
lines
.
extend
([
" "
+
x
lines
.
extend
([
" "
+
x
for
x
in
self
.
Map
(
for
x
in
self
.
Map
(
"%s.arr[i%s]"
%
(
srcCVariable
,
uniqueId
),
"%s.arr[i%s]"
%
(
srcCVariable
,
uniqueId
),
prefix
+
"::Elem"
,
prefix
+
"::Elem"
,
...
@@ -153,7 +154,7 @@ def main():
...
@@ -153,7 +154,7 @@ def main():
if
sys
.
argv
.
count
(
"-o"
)
!=
0
:
if
sys
.
argv
.
count
(
"-o"
)
!=
0
:
idx
=
sys
.
argv
.
index
(
"-o"
)
idx
=
sys
.
argv
.
index
(
"-o"
)
try
:
try
:
commonPy
.
configMT
.
outputDir
=
os
.
path
.
normpath
(
sys
.
argv
[
idx
+
1
])
+
os
.
sep
commonPy
.
configMT
.
outputDir
=
os
.
path
.
normpath
(
sys
.
argv
[
idx
+
1
])
+
os
.
sep
except
:
# pragma: no cover
except
:
# pragma: no cover
usage
()
# pragma: no cover
usage
()
# pragma: no cover
del
sys
.
argv
[
idx
]
del
sys
.
argv
[
idx
]
...
@@ -239,7 +240,7 @@ def main():
...
@@ -239,7 +240,7 @@ def main():
C_SourceFile
.
write
(
'#ifdef __linux__
\n
'
)
C_SourceFile
.
write
(
'#ifdef __linux__
\n
'
)
C_SourceFile
.
write
(
' pthread_mutex_lock(&g_printing_mutex);
\n
'
)
C_SourceFile
.
write
(
' pthread_mutex_lock(&g_printing_mutex);
\n
'
)
C_SourceFile
.
write
(
'#endif
\n
'
)
C_SourceFile
.
write
(
'#endif
\n
'
)
lines
=
[
" "
+
x
lines
=
[
" "
+
x
for
x
in
printer
.
Map
(
for
x
in
printer
.
Map
(
'(*pData)'
,
'(*pData)'
,
''
,
''
,
...
...
A_mappers/msgPrinterASN1.py
View file @
a51da808
...
@@ -129,7 +129,7 @@ class Printer(RecursiveMapper):
...
@@ -129,7 +129,7 @@ class Printer(RecursiveMapper):
(
self
.
maybeElse
(
childNo
),
srcCVariable
,
self
.
CleanName
(
child
[
2
])))
(
self
.
maybeElse
(
childNo
),
srcCVariable
,
self
.
CleanName
(
child
[
2
])))
lines
.
append
(
" printf(
\"
%s:
\"
);"
%
child
[
0
])
# Choices need the field name printed
lines
.
append
(
" printf(
\"
%s:
\"
);"
%
child
[
0
])
# Choices need the field name printed
lines
.
extend
(
lines
.
extend
(
[
' '
+
x
[
' '
+
x
for
x
in
self
.
Map
(
for
x
in
self
.
Map
(
"%s.u.%s"
%
(
srcCVariable
,
self
.
CleanName
(
child
[
0
])),
"%s.u.%s"
%
(
srcCVariable
,
self
.
CleanName
(
child
[
0
])),
prefix
+
"::"
+
self
.
CleanName
(
child
[
0
]),
prefix
+
"::"
+
self
.
CleanName
(
child
[
0
]),
...
@@ -150,7 +150,7 @@ class Printer(RecursiveMapper):
...
@@ -150,7 +150,7 @@ class Printer(RecursiveMapper):
lines
.
append
(
" if (i%s) "
%
uniqueId
)
lines
.
append
(
" if (i%s) "
%
uniqueId
)
lines
.
append
(
" printf(
\"
,
\"
);"
)
lines
.
append
(
" printf(
\"
,
\"
);"
)
lines
.
extend
(
lines
.
extend
(
[
" "
+
x
[
" "
+
x
for
x
in
self
.
Map
(
for
x
in
self
.
Map
(
"%s.arr[i%s]"
%
(
srcCVariable
,
uniqueId
),
"%s.arr[i%s]"
%
(
srcCVariable
,
uniqueId
),
prefix
+
"::Elem"
,
prefix
+
"::Elem"
,
...
@@ -173,7 +173,7 @@ def main():
...
@@ -173,7 +173,7 @@ def main():
if
sys
.
argv
.
count
(
"-o"
)
!=
0
:
if
sys
.
argv
.
count
(
"-o"
)
!=
0
:
idx
=
sys
.
argv
.
index
(
"-o"
)
idx
=
sys
.
argv
.
index
(
"-o"
)
try
:
try
:
commonPy
.
configMT
.
outputDir
=
os
.
path
.
normpath
(
sys
.
argv
[
idx
+
1
])
+
os
.
sep
commonPy
.
configMT
.
outputDir
=
os
.
path
.
normpath
(
sys
.
argv
[
idx
+
1
])
+
os
.
sep
except
:
# pragma: no cover
except
:
# pragma: no cover
usage
()
# pragma: no cover
usage
()
# pragma: no cover
del
sys
.
argv
[
idx
]
del
sys
.
argv
[
idx
]
...
@@ -262,7 +262,7 @@ def main():
...
@@ -262,7 +262,7 @@ def main():
C_SourceFile
.
write
(
' //printf("%%s %s ::= ", paramName);
\n
'
%
nodeTypename
)
C_SourceFile
.
write
(
' //printf("%%s %s ::= ", paramName);
\n
'
%
nodeTypename
)
C_SourceFile
.
write
(
' printf("%s ", paramName);
\n
'
)
C_SourceFile
.
write
(
' printf("%s ", paramName);
\n
'
)
# C_SourceFile.write('\n'.join(printer.Map('(*pData)', '', node, leafTypeDict, commonPy.asnParser.g_names)))
# C_SourceFile.write('\n'.join(printer.Map('(*pData)', '', node, leafTypeDict, commonPy.asnParser.g_names)))
lines
=
[
" "
+
x
for
x
in
printer
.
Map
(
'(*pData)'
,
''
,
node
,
leafTypeDict
,
commonPy
.
asnParser
.
g_names
)]
lines
=
[
" "
+
x
for
x
in
printer
.
Map
(
'(*pData)'
,
''
,
node
,
leafTypeDict
,
commonPy
.
asnParser
.
g_names
)]
C_SourceFile
.
write
(
"
\n
"
.
join
(
lines
))
C_SourceFile
.
write
(
"
\n
"
.
join
(
lines
))
C_SourceFile
.
write
(
'
\n
#ifdef __linux__
\n
'
)
C_SourceFile
.
write
(
'
\n
#ifdef __linux__
\n
'
)
C_SourceFile
.
write
(
' pthread_mutex_unlock(&g_printing_mutex);
\n
'
)
C_SourceFile
.
write
(
' pthread_mutex_unlock(&g_printing_mutex);
\n
'
)
...
...
A_mappers/python_A_mapper.py
View file @
a51da808
...
@@ -350,17 +350,17 @@ def CreateGettersAndSetters(path, params, accessPathInC, node, names, leafTypeDi
...
@@ -350,17 +350,17 @@ def CreateGettersAndSetters(path, params, accessPathInC, node, names, leafTypeDi
if
node
.
_range
==
[]:
if
node
.
_range
==
[]:
panic
(
"Python_A_mapper: string (in %s) must have a SIZE constraint!
\n
"
%
node
.
Location
())
# pragma: no cover
panic
(
"Python_A_mapper: string (in %s) must have a SIZE constraint!
\n
"
%
node
.
Location
())
# pragma: no cover
if
isSequenceVariable
(
node
):
if
isSequenceVariable
(
node
):
CommonBaseImpl
(
"OCTETSTRING"
,
"long"
,
path
,
params
,
accessPathInC
+
".nCount"
,
"Length"
)
CommonBaseImpl
(
"OCTETSTRING"
,
"long"
,
path
,
params
,
accessPathInC
+
".nCount"
,
"Length"
)
else
:
else
:
CommonBaseImplSequenceFixed
(
"OCTETSTRING"
,
"long"
,
path
,
params
,
accessPathInC
+
".nCount"
,
node
,
"Length"
)
CommonBaseImplSequenceFixed
(
"OCTETSTRING"
,
"long"
,
path
,
params
,
accessPathInC
+
".nCount"
,
node
,
"Length"
)
params
.
AddParam
(
'int'
,
"iDx"
,
leafTypeDict
)
params
.
AddParam
(
'int'
,
"iDx"
,
leafTypeDict
)
CommonBaseImpl
(
"OCTETSTRING_bytes"
,
"byte"
,
path
+
"_iDx"
,
params
,
accessPathInC
+
(
".arr["
+
params
.
_vars
[
-
1
]
+
"]"
),
""
)
CommonBaseImpl
(
"OCTETSTRING_bytes"
,
"byte"
,
path
+
"_iDx"
,
params
,
accessPathInC
+
(
".arr["
+
params
.
_vars
[
-
1
]
+
"]"
),
""
)
params
.
Pop
()
params
.
Pop
()
elif
isinstance
(
node
,
AsnEnumerated
):
elif
isinstance
(
node
,
AsnEnumerated
):
CommonBaseImpl
(
"ENUMERATED"
,
"int"
,
path
,
params
,
accessPathInC
)
CommonBaseImpl
(
"ENUMERATED"
,
"int"
,
path
,
params
,
accessPathInC
)
elif
isinstance
(
node
,
AsnSequence
)
or
isinstance
(
node
,
AsnSet
)
or
isinstance
(
node
,
AsnChoice
):
elif
isinstance
(
node
,
AsnSequence
)
or
isinstance
(
node
,
AsnSet
)
or
isinstance
(
node
,
AsnChoice
):
if
isinstance
(
node
,
AsnChoice
):
if
isinstance
(
node
,
AsnChoice
):
CommonBaseImpl
(
"CHOICE selector"
,
"int"
,
path
+
"_kind"
,
params
,
accessPathInC
+
".kind"
)
CommonBaseImpl
(
"CHOICE selector"
,
"int"
,
path
+
"_kind"
,
params
,
accessPathInC
+
".kind"
)
union
=
""
union
=
""
if
isinstance
(
node
,
AsnChoice
):
if
isinstance
(
node
,
AsnChoice
):
union
=
".u"
union
=
".u"
...
@@ -372,18 +372,18 @@ def CreateGettersAndSetters(path, params, accessPathInC, node, names, leafTypeDi
...
@@ -372,18 +372,18 @@ def CreateGettersAndSetters(path, params, accessPathInC, node, names, leafTypeDi
baseTypeOfChild
=
leafTypeDict
.
get
(
baseTypeOfChild
,
baseTypeOfChild
)
baseTypeOfChild
=
leafTypeDict
.
get
(
baseTypeOfChild
,
baseTypeOfChild
)
if
baseTypeOfChild
not
in
[
'INTEGER'
,
'REAL'
,
'BOOLEAN'
,
'OCTET STRING'
,
'ENUMERATED'
]:
if
baseTypeOfChild
not
in
[
'INTEGER'
,
'REAL'
,
'BOOLEAN'
,
'OCTET STRING'
,
'ENUMERATED'
]:
useStar
=
''
if
baseTypeOfChild
.
endswith
(
'OF'
)
else
'*'
useStar
=
''
if
baseTypeOfChild
.
endswith
(
'OF'
)
else
'*'
CommonBaseImpl
(
"Field "
+
childVarname
+
" selector"
,
CleanNameAsPythonWants
(
childNode
.
_containedType
)
+
useStar
,
path
+
"_"
+
childVarname
,
params
,
accessPathInC
+
union
+
"."
+
childVarname
,
returnPointer
=
not
baseTypeOfChild
.
endswith
(
'OF'
))
CommonBaseImpl
(
"Field "
+
childVarname
+
" selector"
,
CleanNameAsPythonWants
(
childNode
.
_containedType
)
+
useStar
,
path
+
"_"
+
childVarname
,
params
,
accessPathInC
+
union
+
"."
+
childVarname
,
returnPointer
=
not
baseTypeOfChild
.
endswith
(
'OF'
))
CreateGettersAndSetters
(
path
+
"_"
+
childVarname
,
params
,
accessPathInC
+
union
+
"."
+
childVarname
,
child
[
1
],
names
,
leafTypeDict
)
CreateGettersAndSetters
(
path
+
"_"
+
childVarname
,
params
,
accessPathInC
+
union
+
"."
+
childVarname
,
child
[
1
],
names
,
leafTypeDict
)
elif
isinstance
(
node
,
AsnSequenceOf
)
or
isinstance
(
node
,
AsnSetOf
):
elif
isinstance
(
node
,
AsnSequenceOf
)
or
isinstance
(
node
,
AsnSetOf
):
containedNode
=
node
.
_containedType
containedNode
=
node
.
_containedType
if
isinstance
(
containedNode
,
str
):
if
isinstance
(
containedNode
,
str
):
containedNode
=
names
[
containedNode
]
containedNode
=
names
[
containedNode
]
if
isSequenceVariable
(
node
):
if
isSequenceVariable
(
node
):
CommonBaseImpl
(
"SEQUENCEOF/SETOF"
,
"long"
,
path
,
params
,
accessPathInC
+
".nCount"
,
"Length"
)
CommonBaseImpl
(
"SEQUENCEOF/SETOF"
,
"long"
,
path
,
params
,
accessPathInC
+
".nCount"
,
"Length"
)
else
:
else
:
CommonBaseImplSequenceFixed
(
"SEQUENCEOF/SETOF"
,
"long"
,
path
,
params
,
accessPathInC
+
".nCount"
,
node
,
"Length"
)
CommonBaseImplSequenceFixed
(
"SEQUENCEOF/SETOF"
,
"long"
,
path
,
params
,
accessPathInC
+
".nCount"
,
node
,
"Length"
)
params
.
AddParam
(
'int'
,
"iDx"
,
leafTypeDict
)
params
.
AddParam
(
'int'
,
"iDx"
,
leafTypeDict
)
CreateGettersAndSetters
(
path
+
"_iDx"
,
params
,
accessPathInC
+
(
".arr["
+
params
.
_vars
[
-
1
]
+
"]"
),
node
.
_containedType
,
names
,
leafTypeDict
)
CreateGettersAndSetters
(
path
+
"_iDx"
,
params
,
accessPathInC
+
(
".arr["
+
params
.
_vars
[
-
1
]
+
"]"
),
node
.
_containedType
,
names
,
leafTypeDict
)
params
.
Pop
()
params
.
Pop
()
...
@@ -448,8 +448,8 @@ def DumpTypeDumper(codeIndent, outputIndent, lines, variableName, node, names):
...
@@ -448,8 +448,8 @@ def DumpTypeDumper(codeIndent, outputIndent, lines, variableName, node, names):
lines
.
append
(
codeIndent
+
'def emitElem(i):'
)
lines
.
append
(
codeIndent
+
'def emitElem(i):'
)
lines
.
append
(
codeIndent
+
' if i>0:'
)
lines
.
append
(
codeIndent
+
' if i>0:'
)
lines
.
append
(
codeIndent
+
' lines.append(",")'
)
lines
.
append
(
codeIndent
+
' lines.append(",")'
)
DumpTypeDumper
(
codeIndent
+
" "
,
outputIndent
+
" "
,
lines
,
DumpTypeDumper
(
codeIndent
+
" "
,
outputIndent
+
" "
,
lines
,
variableName
+
'[i]'
,
containedNode
,
names
)
variableName
+
'[i]'
,
containedNode
,
names
)
lines
.
append
(
codeIndent
+
"map(emitElem, xrange(%s.GetLength()))"
%
variableName
)
lines
.
append
(
codeIndent
+
"map(emitElem, xrange(%s.GetLength()))"
%
variableName
)
lines
.
append
(
codeIndent
+
'lines.append("}")'
)
lines
.
append
(
codeIndent
+
'lines.append("}")'
)
...
@@ -480,7 +480,7 @@ def CreateDeclarationForType(nodeTypename: str, names: AST_Lookup, leafTypeDict:
...
@@ -480,7 +480,7 @@ def CreateDeclarationForType(nodeTypename: str, names: AST_Lookup, leafTypeDict:
g_outputFile
.
write
(
" super("
+
name
+
", self).__init__(
\"
"
+
name
+
"
\"
, ptr)
\n
"
)
g_outputFile
.
write
(
" super("
+
name
+
", self).__init__(
\"
"
+
name
+
"
\"
, ptr)
\n
"
)
if
isinstance
(
node
,
AsnString
):
if
isinstance
(
node
,
AsnString
):
g_outputFile
.
write
(
'''#
\n
'''
)
g_outputFile
.
write
(
'''#
\n
'''
)
CreateGettersAndSetters
(
name
+
"_"
,
Params
(
nodeTypename
),
""
,
node
,
names
,
leafTypeDict
)
CreateGettersAndSetters
(
name
+
"_"
,
Params
(
nodeTypename
),
""
,
node
,
names
,
leafTypeDict
)
g_outputFile
.
write
(
"
\n
def GSER(self):
\n
"
)
g_outputFile
.
write
(
"
\n
def GSER(self):
\n
"
)
g_outputFile
.
write
(
" ''' Return the GSER representation of the value '''
\n
"
)
g_outputFile
.
write
(
" ''' Return the GSER representation of the value '''
\n
"
)
g_outputFile
.
write
(
" lines = []
\n
"
)
g_outputFile
.
write
(
" lines = []
\n
"
)
...
...
A_mappers/qgenada_A_mapper.py
View file @
a51da808
...
@@ -284,7 +284,7 @@ def CreateDeclarationForType(nodeTypename, names, leafTypeDict):
...
@@ -284,7 +284,7 @@ def CreateDeclarationForType(nodeTypename, names, leafTypeDict):
if
elemNo
>
1
:
if
elemNo
>
1
:
g_outputFile
.
write
(
'['
)
g_outputFile
.
write
(
'['
)
for
i
in
range
(
0
,
elemNo
):
for
i
in
range
(
0
,
elemNo
):
g_outputFile
.
write
(
"%s_elem%02d "
%
(
CleanNameAsSimulinkWants
(
nodeTypename
),
i
+
1
))
g_outputFile
.
write
(
"%s_elem%02d "
%
(
CleanNameAsSimulinkWants
(
nodeTypename
),
i
+
1
))
if
elemNo
>
1
:
if
elemNo
>
1
:
g_outputFile
.
write
(
']'
)
g_outputFile
.
write
(
']'
)
g_outputFile
.
write
(
";
\n\n
"
)
g_outputFile
.
write
(
";
\n\n
"
)
...
...
A_mappers/qgenc_A_mapper.py
View file @
a51da808
...
@@ -263,7 +263,7 @@ def CreateDeclarationForType(nodeTypename, names, leafTypeDict):
...
@@ -263,7 +263,7 @@ def CreateDeclarationForType(nodeTypename, names, leafTypeDict):
if
elemNo
>
1
:
if
elemNo
>
1
:
g_outputFile
.
write
(
'['
)
g_outputFile
.
write
(
'['
)
for
i
in
range
(
0
,
elemNo
):
for
i
in
range
(
0
,
elemNo
):
g_outputFile
.
write
(
"%s_elem%02d "
%
(
CleanNameAsSimulinkWants
(
nodeTypename
),
i
+
1
))
g_outputFile
.
write
(
"%s_elem%02d "
%
(
CleanNameAsSimulinkWants
(
nodeTypename
),
i
+
1
))
if
elemNo
>
1
:
if
elemNo
>
1
:
g_outputFile
.
write
(
']'
)
g_outputFile
.
write
(
']'
)
g_outputFile
.
write
(
";
\n\n
"
)
g_outputFile
.
write
(
";
\n\n
"
)
...
...
A_mappers/scade6_A_mapper.py
View file @
a51da808
...
@@ -302,14 +302,14 @@ def OnEnumerated(nodeTypename, node, unused_leafTypeDict):
...
@@ -302,14 +302,14 @@ def OnEnumerated(nodeTypename, node, unused_leafTypeDict):
# g_outputFile.write("\t %s[%s]" % (CleanNameAsScadeWants(member[0]), member[1]))
# g_outputFile.write("\t %s[%s]" % (CleanNameAsScadeWants(member[0]), member[1]))
controlString
+=
'Value$name=%(enumerant)s`values,pragmas,ed:Value$oid=%(oid)s,kcg:Pragma`pragmas,TEXTenum_val %(value)s,'
%
{
controlString
+=
'Value$name=%(enumerant)s`values,pragmas,ed:Value$oid=%(oid)s,kcg:Pragma`pragmas,TEXTenum_val %(value)s,'
%
{
"enumerant"
:
CleanNameAsScadeWants
(
member
[
0
]),
"enumerant"
:
CleanNameAsScadeWants
(
member
[
0
]),
"oid"
:
GetOID
(
nodeTypename
+
"_"
+
member
[
0
]),
"oid"
:
GetOID
(
nodeTypename
+
"_"
+
member
[
0
]),
"value"
:
member
[
1
]
"value"
:
member
[
1
]
}
}
else
:
# pragma: no cover
else
:
# pragma: no cover
controlString
+=
'Value$name=%(enumerant)s`values,pragmas,ed:Value$oid=%(oid)s,'
%
\
controlString
+=
'Value$name=%(enumerant)s`values,pragmas,ed:Value$oid=%(oid)s,'
%
\
{
# pragma: no cover
{
# pragma: no cover
"enumerant"
:
CleanNameAsScadeWants
(
member
[
0
]),
# pragma: no cover
"enumerant"
:
CleanNameAsScadeWants
(
member
[
0
]),
# pragma: no cover
"oid"
:
GetOID
(
nodeTypename
+
"_"
+
member
[
0
])
# pragma: no cover
"oid"
:
GetOID
(
nodeTypename
+
"_"
+
member
[
0
])
# pragma: no cover
}
# pragma: no cover
}
# pragma: no cover
controlString
+=
'pragmas`Type,ed:Type$oid=!ed/%(oid)s'
%
{
"oid"
:
oid
}
controlString
+=
'pragmas`Type,ed:Type$oid=!ed/%(oid)s'
%
{
"oid"
:
oid
}
RenderElements
(
controlString
)
RenderElements
(
controlString
)
...
...
A_mappers/simulink_A_mapper.py
View file @
a51da808
...
@@ -261,7 +261,7 @@ def CreateDeclarationForType(nodeTypename, names, leafTypeDict):
...
@@ -261,7 +261,7 @@ def CreateDeclarationForType(nodeTypename, names, leafTypeDict):
if
elemNo
>
1
:
if
elemNo
>
1
:
g_outputFile
.
write
(
'['
)
g_outputFile
.
write
(
'['
)
for
i
in
range
(
0
,
elemNo
):
for
i
in
range
(
0
,
elemNo
):
g_outputFile
.
write
(
"%s_elem%02d "
%
(
CleanNameAsSimulinkWants
(
nodeTypename
),
i
+
1
))
g_outputFile
.
write
(
"%s_elem%02d "
%
(
CleanNameAsSimulinkWants
(
nodeTypename
),
i
+
1
))
if
elemNo
>
1
:
if
elemNo
>
1
:
g_outputFile
.
write
(
']'
)
g_outputFile
.
write
(
']'
)
g_outputFile
.
write
(
";
\n\n
"
)
g_outputFile
.
write
(
";
\n\n
"
)
...
...
A_mappers/sqlalchemy_A_mapper.py
View file @
a51da808
...
@@ -363,8 +363,8 @@ class {cleanTypename}_SQL(Base):
...
@@ -363,8 +363,8 @@ class {cleanTypename}_SQL(Base):
def
CreateEnumerated
(
nodeTypename
,
node
,
unused_leafTypeDict
):
def
CreateEnumerated
(
nodeTypename
,
node
,
unused_leafTypeDict
):
checkConstraint
=
' OR '
.
join
(
'data='
+
x
[
1
]
for
x
in
node
.
_members
)
checkConstraint
=
' OR '
.
join
(
'data='
+
x
[
1
]
for
x
in
node
.
_members
)
constants
=
'
\n
'
.
join
(
CleanName
(
x
[
0
])
+
' = '
+
x
[
1
]
constants
=
'
\n
'
.
join
(
CleanName
(
x
[
0
])
+
' = '
+
x
[
1
]
for
x
in
node
.
_members
)
for
x
in
node
.
_members
)
# defValue = CleanName(nodeTypename) + "_SQL." + CleanName(node._members[0][0])
# defValue = CleanName(nodeTypename) + "_SQL." + CleanName(node._members[0][0])
g_sqlalchemyOutput
.
write
(
'''
g_sqlalchemyOutput
.
write
(
'''
...
...
B_mappers/antlr.main.py
View file @
a51da808
...
@@ -26,7 +26,7 @@ def main():
...
@@ -26,7 +26,7 @@ def main():
for
si
in
SystemsAndImplementations
:
for
si
in
SystemsAndImplementations
:
sp
,
sp_impl
,
modelingLanguage
,
fv_name
=
si
[
0
],
si
[
1
],
si
[
2
],
si
[
3
]
sp
,
sp_impl
,
modelingLanguage
,
fv_name
=
si
[
0
],
si
[
1
],
si
[
2
],
si
[
3
]
sp
=
commonPy
.
aadlAST
.
g_apLevelContainers
[
sp
]
sp
=
commonPy
.
aadlAST
.
g_apLevelContainers
[
sp
]
print
(
sp
.
_id
+
"."
+
sp_impl
,
"("
,
modelingLanguage
,
") FV_name:"
,
fv_name
)
print
(
sp
.
_id
+
"."
+
sp_impl
,
"("
,
modelingLanguage
,
") FV_name:"
,
fv_name
)
for
param
in
sp
.
_params
:
for
param
in
sp
.
_params
:
print
(
"
\t
"
,
end
=
' '
)
print
(
"
\t
"
,
end
=
' '
)
if
isinstance
(
param
,
commonPy
.
aadlAST
.
InParam
):
if
isinstance
(
param
,
commonPy
.
aadlAST
.
InParam
):
...
@@ -43,7 +43,7 @@ def main():
...
@@ -43,7 +43,7 @@ def main():
if
len
(
sp
.
_connections
):
if
len
(
sp
.
_connections
):
print
(
"
\t
Connections:"
)
print
(
"
\t
Connections:"
)
for
pair
in
sp
.
_connections
:
for
pair
in
sp
.
_connections
:
print
(
"
\t\t
from"
,
pair
.
_from
.
_componentId
+
':'
+
pair
.
_from
.
_portId
,
"to"
,
pair
.
_to
.
_componentId
+
':'
+
pair
.
_to
.
_portId
)
print
(
"
\t\t
from"
,
pair
.
_from
.
_componentId
+
':'
+
pair
.
_from
.
_portId
,
"to"
,
pair
.
_to
.
_componentId
+
':'
+
pair
.
_to
.
_portId
)
print
()
print
()
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
B_mappers/c_B_mapper.py
View file @
a51da808
...
@@ -104,7 +104,7 @@ class FromCtoOSS(RecursiveMapper):
...
@@ -104,7 +104,7 @@ class FromCtoOSS(RecursiveMapper):
lines
.
append
(
"%sif (%s.kind == %s) {
\n
"
%
lines
.
append
(
"%sif (%s.kind == %s) {
\n
"
%
(
self
.
maybeElse
(
childNo
),
srcCVariable
,
self
.
CleanName
(
child
[
2
])))
(
self
.
maybeElse
(
childNo
),
srcCVariable
,
self
.
CleanName
(
child
[
2
])))
lines
.
extend
(
lines
.
extend
(
[
' '
+
x
[
' '
+
x
for
x
in
self
.
Map
(
for
x
in
self
.
Map
(
"%s.u.%s"
%
(
srcCVariable
,
self
.
CleanName
(
child
[
0
])),
"%s.u.%s"
%
(
srcCVariable
,
self
.
CleanName
(
child
[
0
])),
destVar
+
".u."
+
self
.
CleanName
(
child
[
0
]),
destVar
+
".u."
+
self
.
CleanName
(
child
[
0
]),
...
@@ -123,7 +123,7 @@ class FromCtoOSS(RecursiveMapper):
...
@@ -123,7 +123,7 @@ class FromCtoOSS(RecursiveMapper):
limit
=
sourceSequenceLimit
(
node
,
srcCVariable
)
limit
=
sourceSequenceLimit
(
node
,
srcCVariable
)
lines
.
append
(
" for(i%s=0; i%s<%s; i%s++) {
\n
"
%
(
uniqueId
,
uniqueId
,
limit
,
uniqueId
))
lines
.
append
(
" for(i%s=0; i%s<%s; i%s++) {
\n
"
%
(
uniqueId
,
uniqueId
,
limit
,
uniqueId
))
lines
.
extend
(
lines
.
extend
(
[
" "
+
x
[
" "
+
x
for
x
in
self
.
Map
(
for
x
in
self
.
Map
(
"%s.arr[i%s]"
%
(
srcCVariable
,
uniqueId
),
"%s.arr[i%s]"
%
(
srcCVariable
,
uniqueId
),
"%s.value[i%s]"
%
(
destVar
,
uniqueId
),
"%s.value[i%s]"
%
(
destVar
,
uniqueId
),
...
@@ -194,7 +194,7 @@ class FromOSStoC(RecursiveMapper):
...
@@ -194,7 +194,7 @@ class FromOSStoC(RecursiveMapper):
lines
.
append
(
"%sif (%s.choice == OSS_%s_chosen) {
\n
"
%
lines
.
append
(
"%sif (%s.choice == OSS_%s_chosen) {
\n
"
%
(
self
.
maybeElse
(
childNo
),
srcVar
,
self
.
CleanName
(
child
[
0
])))
(
self
.
maybeElse
(
childNo
),
srcVar
,
self
.
CleanName
(
child
[
0
])))
lines
.
extend
(
lines
.
extend
(
[
' '
+
x
[
' '
+
x
for
x
in
self
.
Map
(
for
x
in
self
.
Map
(
srcVar
+
".u."
+
self
.
CleanName
(
child
[
0
]),
srcVar
+
".u."
+
self
.
CleanName
(
child
[
0
]),
"%s.u.%s"
%
(
dstCVariable
,
self
.
CleanName
(
child
[
0
])),
"%s.u.%s"
%
(
dstCVariable
,
self
.
CleanName
(
child
[
0
])),
...
@@ -215,7 +215,7 @@ class FromOSStoC(RecursiveMapper):
...
@@ -215,7 +215,7 @@ class FromOSStoC(RecursiveMapper):
lines
.
append
(
" for(i%s=0; i%s<%s; i%s++) {
\n
"
%
lines
.
append
(
" for(i%s=0; i%s<%s; i%s++) {
\n
"
%
(
uniqueId
,
uniqueId
,
targetSequenceLimit
(
node
,
dstCVariable
),
uniqueId
))
(
uniqueId
,
uniqueId
,
targetSequenceLimit
(
node
,
dstCVariable
),
uniqueId
))
lines
.
extend
(
lines
.
extend
(
[
" "
+
x
[
" "
+
x
for
x
in
self
.
Map
(
for
x
in
self
.
Map
(
srcVar
+
".value[i%s]"
%
uniqueId
,
srcVar
+
".value[i%s]"
%
uniqueId
,
"%s.arr[i%s]"
%
(
dstCVariable
,
uniqueId
),
"%s.arr[i%s]"
%
(
dstCVariable
,
uniqueId
),
...
@@ -291,7 +291,7 @@ class C_GlueGenerator(ASynchronousToolGlueGenerator):
...
@@ -291,7 +291,7 @@ class C_GlueGenerator(ASynchronousToolGlueGenerator):
node
,
node
,
leafTypeDict
,
leafTypeDict
,
names
)
names
)
lines
=
[
" "
+
x
for
x
in
lines
]
lines
=
[
" "
+
x
for
x
in
lines
]
self
.
C_SourceFile
.
write
(
""
.
join
(
lines
))
self
.
C_SourceFile
.
write
(
""
.
join
(
lines
))
if
self
.
useOSS
and
encoding
.
lower
()
==
"uper"
:
if
self
.
useOSS
and
encoding
.
lower
()
==
"uper"
:
...
@@ -386,7 +386,7 @@ class C_GlueGenerator(ASynchronousToolGlueGenerator):
...
@@ -386,7 +386,7 @@ class C_GlueGenerator(ASynchronousToolGlueGenerator):
node
,
node
,
leafTypeDict
,
leafTypeDict
,
names
)
names
)
lines
=
[
" "
+
x
for
x
in
lines
]
lines
=
[
" "
+
x
for
x
in
lines
]
self
.
C_SourceFile
.
write
(
""
.
join
(
lines
))
self
.
C_SourceFile
.
write
(
""
.
join
(
lines
))
if
self
.
useOSS
and
encoding
.
lower
()
==
"uper"
:
if
self
.
useOSS
and
encoding
.
lower
()
==
"uper"
:
...
...
B_mappers/gui_B_mapper.py
View file @
a51da808
...
@@ -220,15 +220,15 @@ def OneTimeOnly(unused_modelingLanguage, asnFile, subProgram, subProgramImplemen
...
@@ -220,15 +220,15 @@ def OneTimeOnly(unused_modelingLanguage, asnFile, subProgram, subProgramImplemen
#define SYMBOL_TELECMDS_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxDIALOG_MODAL|wxTAB_TRAVERSAL
#define SYMBOL_TELECMDS_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxDIALOG_MODAL|wxTAB_TRAVERSAL
'''
)
'''
)
global
g_IDs
global
g_IDs
g_HeaderFile
.
write
(
"#define ID_MENU_RI "
+
str
(
g_IDs
)
+
"
\n
"
)
g_HeaderFile
.
write
(
"#define ID_MENU_RI "
+
str
(
g_IDs
)
+
"
\n
"
)
g_IDs
+=
1
g_IDs
+=
1
g_HeaderFile
.
write
(
"#define ID_MENU_SAVE "
+
str
(
g_IDs
)
+
"
\n
"
)
g_HeaderFile
.
write
(
"#define ID_MENU_SAVE "
+
str
(
g_IDs
)
+
"
\n
"
)
g_IDs
+=
1
g_IDs
+=
1
g_HeaderFile
.
write
(
"#define ID_MENU_LOAD "
+
str
(
g_IDs
)
+
"
\n
"
)
g_HeaderFile
.
write
(
"#define ID_MENU_LOAD "
+
str
(
g_IDs
)
+
"
\n
"
)
g_IDs
+=
1
g_IDs
+=
1
g_HeaderFile
.
write
(
"#define ID_MENU_ABOUT "
+
str
(
g_IDs
)
+
"
\n
"
)
g_HeaderFile
.
write
(
"#define ID_MENU_ABOUT "
+
str
(
g_IDs
)
+
"
\n
"
)
g_IDs
+=
1
g_IDs
+=
1
g_HeaderFile
.
write
(
"#define ID_MENU_QUIT "
+
str
(
g_IDs
)
+
"
\n
"
)
g_HeaderFile
.
write
(
"#define ID_MENU_QUIT "
+
str
(
g_IDs
)
+
"
\n
"
)
g_IDs
+=
1
g_IDs
+=
1
g_HeaderFile
.
write
(
"
\n
"
)
g_HeaderFile
.
write
(
"
\n
"
)
g_HeaderFile
.
write
(
'''
g_HeaderFile
.
write
(
'''
...
@@ -257,13 +257,13 @@ public:
...
@@ -257,13 +257,13 @@ public:
};
};
'''
)
'''
)
global
g_MyEvents
global
g_MyEvents
g_MyEvents
=
open
(
outputDir
+
"MyEvents.inc"
,
"w"
)
g_MyEvents
=
open
(
outputDir
+
"MyEvents.inc"
,
"w"
)
global
g_MyCreation
global
g_MyCreation
g_MyCreation
=
open
(
outputDir
+
"MyCreation.inc"
,
"w"
)
g_MyCreation
=
open
(
outputDir
+
"MyCreation.inc"
,
"w"
)
global
g_MyClickPrototypes
global
g_MyClickPrototypes
g_MyClickPrototypes
=
open
(
outputDir
+
"MyClickPrototypes.inc"
,
"w"
)
g_MyClickPrototypes
=
open
(
outputDir
+
"MyClickPrototypes.inc"
,
"w"
)
global
g_MyControls
global
g_MyControls
g_MyControls
=
open
(
outputDir
+
"MyControls.inc"
,
"w"
)
g_MyControls
=
open
(
outputDir
+
"MyControls.inc"
,
"w"
)
global
g_MyLoad
global
g_MyLoad
g_MyLoad
=
open
(
g_outputDir
+
'MyLoad.inc'
,
'w'
)
g_MyLoad
=
open
(
g_outputDir
+
'MyLoad.inc'
,
'w'
)
global
g_MySave
global
g_MySave
...
@@ -283,7 +283,7 @@ public:
...
@@ -283,7 +283,7 @@ public:
WriteSourceFileStart
()
WriteSourceFileStart
()
g_SourceFile
.
write
(
"
\n
"
)
g_SourceFile
.
write
(
"
\n
"
)
if
maybeFVname
==
""
:
if
maybeFVname
==
""
:
panic
(
"GUI APLCs must have an FV_Name attribute! (%s)
\n
"
%
subProgram
.
_id
+
"."
+
subProgramImplementation
)
# pragma: no cover
panic
(
"GUI APLCs must have an FV_Name attribute! (%s)
\n
"
%
subProgram
.
_id
+
"."
+
subProgramImplementation
)
# pragma: no cover
g_SourceFile
.
write
(
"#include
\"
%s_gui_header.h
\"\n\n
"
%
maybeFVname
)
g_SourceFile
.
write
(
"#include
\"
%s_gui_header.h
\"\n\n
"
%
maybeFVname
)
g_SourceFile
.
write
(
"#include
\"
queue_manager.h
\"\n\n
"
)
g_SourceFile
.
write
(
"#include
\"
queue_manager.h
\"\n\n
"
)
g_SourceFile
.
write
(
"void TeleCmds::OnMenu_Click( wxCommandEvent& event )
\n
{
\n
"
)
g_SourceFile
.
write
(
"void TeleCmds::OnMenu_Click( wxCommandEvent& event )
\n
{
\n
"
)
...
@@ -346,7 +346,7 @@ def OnStartup(modelingLanguage, asnFile, subProgram, subProgramImplementation, o
...
@@ -346,7 +346,7 @@ def OnStartup(modelingLanguage, asnFile, subProgram, subProgramImplementation, o
OneTimeOnly
(
modelingLanguage
,
asnFile
,
subProgram
,
subProgramImplementation
,
outputDir
,
maybeFVname
,
useOSS
)
OneTimeOnly
(
modelingLanguage
,
asnFile
,
subProgram
,
subProgramImplementation
,
outputDir
,
maybeFVname
,
useOSS
)
global
g_IDs
global
g_IDs
CleanSP
=
CleanName
(
subProgram
.
_id
)
CleanSP
=
CleanName
(
subProgram
.
_id
)
g_HeaderFile
.
write
(
"#define ID_SCROLWND_"
+
CleanSP
+
" "
+
str
(
g_IDs
)
+
"
\n
"
)
g_HeaderFile
.
write
(
"#define ID_SCROLWND_"
+
CleanSP
+
" "
+
str
(
g_IDs
)
+
"
\n
"
)
g_IDs
+=
1
g_IDs
+=
1
g_MyEvents
.
write
(
" EVT_MENU( ID_MENU_RI, TeleCmds::OnMenu_Click )
\n
"
)
g_MyEvents
.
write
(
" EVT_MENU( ID_MENU_RI, TeleCmds::OnMenu_Click )
\n
"
)
g_MyEvents
.
write
(
" EVT_MENU( ID_MENU_LOAD, TeleCmds::OnMenu_Load )
\n
"
)
g_MyEvents
.
write
(
" EVT_MENU( ID_MENU_LOAD, TeleCmds::OnMenu_Load )
\n
"
)
...
@@ -382,9 +382,9 @@ def OnStartup(modelingLanguage, asnFile, subProgram, subProgramImplementation, o
...
@@ -382,9 +382,9 @@ def OnStartup(modelingLanguage, asnFile, subProgram, subProgramImplementation, o