summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-07-19 11:34:59 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-07-19 11:34:59 +0200
commit8f12413895954e5feed9ea915825d462f0457fe4 (patch)
tree92b9c7e40cee3b458c8d66b387a18b472d47a37c
parent71c08d4a3ae9763b8cc669aad0f9d53bbc5f95d2 (diff)
No longer add function and literals as waveforms.
-rw-r--r--instr-scripts/Makefile4
-rw-r--r--instr-scripts/process_internals.py24
-rwxr-xr-xinstr-scripts/structural_level.py13
-rw-r--r--instr-to-kodkod/Makefile3
4 files changed, 30 insertions, 14 deletions
diff --git a/instr-scripts/Makefile b/instr-scripts/Makefile
index 5bdc767..43db096 100644
--- a/instr-scripts/Makefile
+++ b/instr-scripts/Makefile
@@ -6,8 +6,8 @@ AST_FILE = ../data/ast/best_chronometer_ever.xml
PYTHON_EXEC = python3
## Structural Level
-SL_INST_FILE = system.sl
-SL_EXTRA_FILE = system_extra.sl
+SL_INST_FILE = structural.mod
+SL_EXTRA_FILE = system_extra.txt
################################################################################
## PROGRAM FILES ###############################################################
diff --git a/instr-scripts/process_internals.py b/instr-scripts/process_internals.py
index 6b63632..378a6c7 100644
--- a/instr-scripts/process_internals.py
+++ b/instr-scripts/process_internals.py
@@ -33,8 +33,9 @@ def new_element (
return result
class Process_Internals:
- def __init__ (self, xml, id_manager, wfm_manager, process_id, output):
+ def __init__ (self, root, xml, id_manager, wfm_manager, process_id, output):
self.xml = xml
+ self.root_xml = root
self.id_manager = id_manager
self.wfm_manager = wfm_manager
self.output = output
@@ -125,6 +126,19 @@ class Process_Internals:
)
for src_xml in sources_xml:
+ ref = src_xml.attrib.get("ref")
+
+ if (self.root_xml.find(".//el[@id=\"" + ref + "\"]") == None):
+ print(
+ "Assumed that \""
+ + src_xml.find("./..").attrib.get("identifier")
+ + "\" is a function or literal (XML id: "
+ + ref
+ + ", could not find source)."
+ )
+
+ continue
+
self.output.write(
"(expr_reads "
+ cond_node_id
@@ -172,7 +186,7 @@ class Process_Internals:
attr
)
self.output.write(
- "(add_option " + cond_node_id + " " + string_id + ")\n"
+ "(has_option " + cond_node_id + " " + string_id + ")\n"
)
#### Depth
@@ -278,7 +292,7 @@ class Process_Internals:
attr
)
self.output.write(
- "(add_option " + node_id + " " + string_id + ")\n"
+ "(has_option " + node_id + " " + string_id + ")\n"
)
#### Depth
@@ -405,7 +419,7 @@ class Process_Internals:
attr
)
self.output.write(
- "(add_option " + cond_node_id + " " + string_id + ")\n"
+ "(has_option " + cond_node_id + " " + string_id + ")\n"
)
#### Depth
@@ -524,7 +538,7 @@ class Process_Internals:
attr
)
self.output.write(
- "(add_option " + node_id + " " + string_id + ")\n"
+ "(has_option " + node_id + " " + string_id + ")\n"
)
#### Depth
diff --git a/instr-scripts/structural_level.py b/instr-scripts/structural_level.py
index a5c9763..0427e3c 100755
--- a/instr-scripts/structural_level.py
+++ b/instr-scripts/structural_level.py
@@ -515,9 +515,10 @@ def handle_process (
inst_list_output.write("\n")
# TODO: use 'pfp' parameter.
- pf = open(('./pfp_id_' + local_id), 'w')
+ pf = open(('./pfp_id_' + local_id + '.mod'), 'w')
internals = process_internals.Process_Internals(
+ root,
elem,
id_manager,
wfm_manager,
@@ -1286,15 +1287,15 @@ parser.add_argument(
parser.add_argument(
'-io', '--instructions-output',
type = argparse.FileType(mode = 'w', encoding = 'UTF-8'),
- default = 'system.sl',
- help = 'Instruction List output file (default: system.sl)',
+ default = 'structural.mod',
+ help = 'Instruction List output file (default: system.mod)',
)
parser.add_argument(
'-eo', '--extra-output',
type = argparse.FileType(mode = 'w', encoding = 'UTF-8'),
- default = 'system_extra.sl',
- help = 'Extra Information output file (default: system_extra.sl)',
+ default = 'system_extra.txt',
+ help = 'Extra Information output file (default: system_extra.txt)',
)
parser.add_argument(
@@ -1302,7 +1303,7 @@ parser.add_argument(
'--process-files-prefix',
type = str,
default = "./process_instr_",
- help = 'Resulting process description files: this + their ID.'
+ help = 'Resulting process description files: this + their ID + ".mod".'
)
args = parser.parse_args()
diff --git a/instr-to-kodkod/Makefile b/instr-to-kodkod/Makefile
index dd80198..7aa3a82 100644
--- a/instr-to-kodkod/Makefile
+++ b/instr-to-kodkod/Makefile
@@ -1,5 +1,6 @@
## Target(s) Configuration #####################################################
-MODEL_FILES = $(wildcard ../data/instructions/*.mod)
+#MODEL_FILES = $(wildcard ../data/instructions/*.mod)
+MODEL_FILES = $(wildcard ../instr-scripts/*.mod)
LEVEL_DIR = $(wildcard ../data/level/*.lvl)
PROPERTY_FILE = ../data/property/unread_waveforms.pro
VAR_PREFIX = "_anon_"