From 2ebddcbc8fdf4b48910e5972c1caf86df1c2b1ab Mon Sep 17 00:00:00 2001 From: Alexander Senier Date: Mon, 18 May 2020 16:05:45 +0200 Subject: [PATCH] Basic GNAT Studio integration A menu is created to check a single file, check all RecordFlux files, generate code for a single file, generate code for all RecordFlux files. FIXME: Files are generated into Object_Dir (cannot be compiled) FIXME: Adding new spec from context menu does not work Ref. #243 --- ide/gnatstudio/recordflux.py | 113 +++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100755 ide/gnatstudio/recordflux.py diff --git a/ide/gnatstudio/recordflux.py b/ide/gnatstudio/recordflux.py new file mode 100755 index 000000000..8db0c5058 --- /dev/null +++ b/ide/gnatstudio/recordflux.py @@ -0,0 +1,113 @@ +"""RecordFlux support for GNAT Studio +""" + + +import GPS +import gs_utils.gnat_rules +from gs_utils import hook + +XML = r""" + + + RecordFlux + .rflx + + + + package + ^[ \\t]*package[ \\t]+((\\w|\\.)+) + 1 + + + type + ^[ \\t]*type[ \\t]+(\\w+) + 1 + + + + + -- + " + True + True + False + + + + + + + + + + rflx check %F + + + + + + " ".join([s.name() + for s in GPS.current_context().project().sources() + if s.language() == "recordflux"]) + + rflx check %1" + + + + + rflx generate -d %o %F + + + + + + " ".join([s.name() + for s in GPS.current_context().project().sources() + if s.language() == "recordflux"]) + + rflx generate -d %o %1" + + + + + + package %(name) is +begin + %_ +end %(name); + + + + + RecordFlux + + + Check + + + + Check All + + + + Generate + + + + Generate All + + + + +""" + +GPS.parse_xml(XML) + +@hook('gps_started') +def __on_gps_started(): + GPS.FileTemplate.register( + alias_name="rflx_package", + label="RecordFlux specification", + unit_param="name", + language="RecordFlux", + is_impl=False)