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
OpenGEODE
Commits
707cc588
Commit
707cc588
authored
Feb 19, 2020
by
Maxime Perrotin
Browse files
keep case of timer names
to match the taste interface in C
parent
b8955a03
Changes
2
Hide whitespace changes
Inline
Side-by-side
opengeode/AdaGenerator.py
View file @
707cc588
...
...
@@ -488,7 +488,7 @@ use {process_name}_newtypes;'''.format(process_name=process_name) \
if
process
.
user_defined_types
else
u
''
taste_template
=
[
u
'''
\
-- This file was generated automatically: DO NOT MODIFY IT !
-- This file was generated automatically
by OpenGEODE
: DO NOT MODIFY IT !
with System.IO;
use System.IO;
...
...
@@ -528,7 +528,7 @@ package body {process_name} is'''.format(
# Generate the source file (.ads) header
ads_template
=
[
u
'''
\
-- This file was generated automatically: DO NOT MODIFY IT !
-- This file was generated automatically
by OpenGEODE
: DO NOT MODIFY IT !
{dataview}
{C}
...
...
@@ -656,7 +656,7 @@ package {process_name} is'''.format(generic=generic_spec,
# Generate the code for each input signal (provided interface) and timers
for
signal
in
process
.
input_signals
+
[
{
'name'
:
timer
.
lower
()
}
for
timer
in
process
.
timers
]:
{
'name'
:
timer
}
for
timer
in
process
.
timers
]:
if
import_context
:
# dont generate anything in stop_condition functions
break
...
...
opengeode/ogParser.py
View file @
707cc588
...
...
@@ -1636,6 +1636,7 @@ def arithmetic_expression(root, context):
# the latter calls fix_expression_types to determine the type of each side
# of the expression. The type of the expression should still be unknown
# at this point (expr.exprType).
op
=
None
def
find_bounds
(
op
,
minL
,
maxL
,
minR
,
maxR
):
# op must be an arithmetic operator from python
candidates
=
[
op
(
float
(
l
),
float
(
r
))
...
...
@@ -1734,6 +1735,10 @@ def arithmetic_expression(root, context):
# default : signed type
kind
=
'Integer32Type'
if
op
is
None
:
raise
TypeError
(
error
(
root
,
"Invalid operator was used in expression"
))
# cast the result to the resulting type and make it a string
bound_min
=
str
(
op
(
bounds
[
'Min'
]))
bound_max
=
str
(
op
(
bounds
[
'Max'
]))
...
...
@@ -1817,6 +1822,8 @@ def arithmetic_expression(root, context):
#print msg
#print (traceback.format_exc())
errors
.
append
(
error
(
root
,
msg
))
except
TypeError
as
err
:
errors
.
append
(
str
(
err
))
if
root
.
type
in
(
lexer
.
REM
,
lexer
.
MOD
)
and
not
isinstance
(
expr
,
ogAST
.
Primary
):
...
...
@@ -3195,7 +3202,11 @@ def text_area_content(root, ta_ast, context):
if
context
.
return_var
:
warnings
.
append
(
'Procedure return variable not supported'
)
elif
child
.
type
==
lexer
.
TIMER
:
timers
=
[
timer
.
text
.
lower
()
for
timer
in
child
.
children
]
# Don't lowercase the timer name, keep it as declared
# otherwise the code generator cannot make the connection with
# the corresponding functions in C to set/reset the timer.
# timers = [timer.text.lower() for timer in child.children]
timers
=
[
timer
.
text
for
timer
in
child
.
children
]
context
.
timers
.
extend
(
timers
)
ta_ast
.
timers
=
timers
elif
child
.
type
==
lexer
.
SIGNAL
:
...
...
Write
Preview
Supports
Markdown
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