Commit ad255ce4 authored by Maxime Perrotin's avatar Maxime Perrotin

Add --taste flag to explicitely target taste

parent 66766fa9
......@@ -135,6 +135,9 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
2.0.41 (05/2019)
- Add --taste flag to target taste integration with kazoo
2.0.40 (04/2019)
- Improve generated gpr file
......
......@@ -155,7 +155,7 @@ def generate(*args, **kwargs):
# Processing of the AST
@generate.register(ogAST.Process)
def _process(process, simu=False, instance=False, **kwargs):
def _process(process, simu=False, instance=False, taste=False, **kwargs):
''' Generate the code for a complete process (AST Top level)
use instance=True to generate the code for a process type instance
rather than the process type itself.
......@@ -823,11 +823,13 @@ package {process_name} is'''.format(generic=generic_spec,
.format(UNICODE_SEP,
signal['name'],
param_spec))
signame = lower(signal['name']) if taste else signal['name']
procname = lower (process_name) if taste else process_name
ads_template.append(u'pragma import(C, RI{sep}{sig},'
u' "{proc}_RI_{sig}");'
.format(sep=UNICODE_SEP,
sig=signal['name'],
proc=process_name))
sig=signame,
proc=procname))
# for the .ads file, generate the declaration of the external procedures
for proc in (proc for proc in process.procedures if proc.external):
......@@ -877,11 +879,13 @@ package {process_name} is'''.format(generic=generic_spec,
elif not generic:
ads_template.append(ri_header + u';')
signame = lower(proc.inputString) if taste else proc.inputString
procname = lower (process_name) if taste else process_name
ads_template.append(u'pragma import(C, RI{sep}{sig},'
u' "{proc}_RI_{sig}");'
.format(sep=UNICODE_SEP,
sig=proc.inputString,
proc=process_name))
sig=signame,
proc=procname))
# for the .ads file, generate the declaration of timers set/reset functions
for timer in process.timers:
......
......@@ -141,7 +141,7 @@ except ImportError:
__all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse']
__version__ = '2.0.40'
__version__ = '2.0.41'
if hasattr(sys, 'frozen'):
# Detect if we are running on Windows (py2exe-generated)
......@@ -2951,6 +2951,8 @@ def parse_args():
help='Save pictures in multiple files (one per floating item)')
parser.add_argument('--readonly', dest='readonly', action='store_true',
help='Set process diagram as read-only')
parser.add_argument('--taste', dest='taste_target', action='store_true',
help='Generate code for TASTE targets')
parser.add_argument('files', metavar='file.pr', type=str, nargs='*',
help='SDL file(s)')
return parser.parse_args()
......@@ -3001,7 +3003,9 @@ def generate(process, options):
if options.toAda or options.shared or options.dll:
LOG.info('Generating Ada code')
try:
AdaGenerator.generate(process, simu=options.shared)
AdaGenerator.generate(process,
simu=options.shared,
taste=options.taste_target)
except (TypeError, ValueError, NameError) as err:
ret = 1
LOG.error(str(err))
......
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