--- a/.hgignore Tue Jan 07 17:01:06 2020 +0100
+++ b/.hgignore Sat Jan 11 01:02:01 2020 +0100
@@ -1,7 +1,9 @@
syntax: glob
*~
+.~*\#
syntax: regexp
^exec/protocol\.(pdf|png|svg)
+^exec/ExecMsg\.(h)
--- a/exec/Makefile Tue Jan 07 17:01:06 2020 +0100
+++ b/exec/Makefile Sat Jan 11 01:02:01 2020 +0100
@@ -1,6 +1,6 @@
-.PHONY: all display display-messages display-protocol
+.PHONY: all display display-messages display-protocol constants
-all: protocol.pdf
+all: protocol.pdf constants
protocol.pdf: messages.csv protocol.csv protocol.sh
./protocol.sh
@@ -12,3 +12,14 @@
display-protocol:
cat protocol.csv | relpipe-in-csv "protocol" | relpipe-out-tabular
+
+constants: ExecMsg.h
+
+ExecMsg.h: messages.csv constants.cpp.sh
+ cat messages.csv | ./constants.cpp.sh > ExecMsg.h
+ g++ ExecMsg.h
+ rm ExecMsg.h.gch
+
+clean:
+ rm -f protocol.pdf
+ rm -f ExecMsg.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/exec/constants.cpp.sh Sat Jan 11 01:02:01 2020 +0100
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+CSV="$(cat)";
+
+echo "// This file was generated from the specification.
+
+#include <map>
+#include <string>
+
+namespace relpipe {
+namespace in {
+namespace filesystem {
+
+class ExecMsg {
+public:
+";
+
+echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT ' static const int ' || message || ';' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo
+
+echo "
+ static std::map<int, std::wstring> getMessageNames() {
+ std::map<int, std::wstring> m;
+";
+
+echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT ' m[' || message || '] = L\"' || message || '\";' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo
+
+echo "
+ return m;
+ }
+
+};
+"
+
+echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT 'const int ExecMsg::' || message || ' = ' || code || ';' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo
+
+echo "
+}
+}
+}";
\ No newline at end of file
--- a/exec/messages.csv Tue Jan 07 17:01:06 2020 +0100
+++ b/exec/messages.csv Sat Jan 11 01:02:01 2020 +0100
@@ -9,11 +9,11 @@
107,COMPLETION_REQUEST,executor,what,value,,
108,COMPLETION,process,value,,,
109,COMPLETION_END,process,,,,
-110,WAITING_FOR_OUTPUT_ATTRIBUTES,executor,,,,
+110,WAITING_FOR_OUTPUT_ATTRIBUTES_METADATA,executor,,,,
111,OUTPUT_ATTRIBUTE_METADATA,process,name,type,,
-112,WAITING_FOR_RECORDS,process,,,,
+112,WAITING_FOR_INPUT_ATTRIBUTES,process,,,,
113,INPUT_ATTRIBUTE,executor,index,value,isNull,
-114,WAITING_FOR_OUTPUT_ATTRIBUTE,executor,,,,
+114,WAITING_FOR_OUTPUT_ATTRIBUTES,executor,,,,
115,OUTPUT_ATTRIBUTE,process,value,isNull,,
116,EXECUTOR_ERROR,executor,code,message,,
117,PROCESS_ERROR,process,code,message,,
--- a/exec/protocol.csv Tue Jan 07 17:01:06 2020 +0100
+++ b/exec/protocol.csv Sat Jan 11 01:02:01 2020 +0100
@@ -10,22 +10,22 @@
OUTPUT_ATTRIBUTE_ALIAS,OUTPUT_ATTRIBUTE_ALIAS,*
OUTPUT_ATTRIBUTE_ALIAS,OPTION,
OPTION,OPTION,*
-OPTION,WAITING_FOR_OUTPUT_ATTRIBUTES,
+OPTION,WAITING_FOR_OUTPUT_ATTRIBUTES_METADATA,
OPTION,COMPLETION_REQUEST,
COMPLETION_REQUEST,COMPLETION,
COMPLETION,COMPLETION,*
COMPLETION,COMPLETION_END,
COMPLETION_END,end,
-WAITING_FOR_OUTPUT_ATTRIBUTES,OUTPUT_ATTRIBUTE_METADATA,
+WAITING_FOR_OUTPUT_ATTRIBUTES_METADATA,OUTPUT_ATTRIBUTE_METADATA,
OUTPUT_ATTRIBUTE_METADATA,OUTPUT_ATTRIBUTE_METADATA,*
-OUTPUT_ATTRIBUTE_METADATA,WAITING_FOR_RECORDS,
-WAITING_FOR_RECORDS,RELATION_END,
-WAITING_FOR_RECORDS,INPUT_ATTRIBUTE,
+OUTPUT_ATTRIBUTE_METADATA,WAITING_FOR_INPUT_ATTRIBUTES,
+WAITING_FOR_INPUT_ATTRIBUTES,RELATION_END,
+WAITING_FOR_INPUT_ATTRIBUTES,INPUT_ATTRIBUTE,
INPUT_ATTRIBUTE,INPUT_ATTRIBUTE,*
-INPUT_ATTRIBUTE,WAITING_FOR_OUTPUT_ATTRIBUTE,
-WAITING_FOR_OUTPUT_ATTRIBUTE,OUTPUT_ATTRIBUTE,
+INPUT_ATTRIBUTE,WAITING_FOR_OUTPUT_ATTRIBUTES,
+WAITING_FOR_OUTPUT_ATTRIBUTES,OUTPUT_ATTRIBUTE,
OUTPUT_ATTRIBUTE,OUTPUT_ATTRIBUTE,*
-OUTPUT_ATTRIBUTE,WAITING_FOR_RECORDS,
+OUTPUT_ATTRIBUTE,WAITING_FOR_INPUT_ATTRIBUTES,
RELATION_END,end,
any_process,EXECUTOR_ERROR,
any_executor,PROCESS_ERROR,