streamlet/constants.cpp.sh
author František Kučera <franta-hg@frantovo.cz>
Sat, 11 Jan 2020 18:06:58 +0100
branchv_0
changeset 3 03cd058c33ba
parent 2 exec/constants.cpp.sh@dace11211dc9
permissions -rwxr-xr-x
rename exec to streamlet
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
#!/bin/bash
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
CSV="$(cat)";
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
echo "// This file was generated from the specification.
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
3
03cd058c33ba rename exec to streamlet
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
     7
#pragma once
03cd058c33ba rename exec to streamlet
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
     8
2
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
#include <map>
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
#include <string>
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
namespace relpipe {
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
namespace in {
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
namespace filesystem {
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
3
03cd058c33ba rename exec to streamlet
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    16
class StreamletMsg {
2
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
public:
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
";
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
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
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
echo "
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
	static std::map<int, std::wstring> getMessageNames() {
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
		std::map<int, std::wstring> m;
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
";
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
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
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
echo "
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
		return m;
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
	}
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
};
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
"
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
3
03cd058c33ba rename exec to streamlet
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    36
echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT 'const int StreamletMsg::' || message || ' = ' || code || ';' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo
2
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
echo "
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
}
dace11211dc9 exec: protocol update + constants generator
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
}
3
03cd058c33ba rename exec to streamlet
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    41
}";