2021-10-31 05:41:19 +00:00
|
|
|
# This script requires HAWK.
|
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
printf ("-- Generated with rune.txt and rune.awk\n");
|
|
|
|
printf ("-- Run hawk -f rune.awk rune.txt > h2-runes.ads for regeneration\n\n");
|
|
|
|
printf ("generic\n");
|
|
|
|
printf ("\ttype Rune_Type is (<>);\n");
|
|
|
|
printf ("package H2.Runes is\n\n");
|
|
|
|
#printf ("\tpragma Preelaborate (Runes);\n\n");
|
|
|
|
printf ("\tpackage P is\n");
|
2021-10-31 16:03:11 +00:00
|
|
|
printf ("\t\t\%-20s: constant Code := %d; -- Code'First\n", "EOF", -1);
|
2021-10-31 05:41:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
t = sprintf ("%c", NR - 1);
|
|
|
|
if (str::isprint(t)) t = " -- " t;
|
|
|
|
else t="";
|
2021-10-31 16:03:11 +00:00
|
|
|
printf ("\t\t%-20s: constant Code := %d;%s\n", $1, NR-1, t);
|
2021-10-31 05:41:19 +00:00
|
|
|
X[NR - 1] = $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
|
|
|
printf ("\tend P;\n\n");
|
|
|
|
|
|
|
|
printf ("\tpackage V is\n");
|
|
|
|
for (i = 0; i < length(X); i++)
|
|
|
|
{
|
|
|
|
printf ("\t\t%-20s: constant Rune := Rune'Val(P.%s);\n", X[i], X[i]);
|
|
|
|
}
|
|
|
|
printf ("\tend V;\n");
|
|
|
|
|
|
|
|
printf ("\n");
|
|
|
|
|
|
|
|
printf ("\nend H2.Runes;\n");
|
2021-10-31 16:03:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (STR !== @nil)
|
|
|
|
{
|
|
|
|
printf ("(");
|
|
|
|
for (j = 1; j <= length(STR); j++)
|
|
|
|
{
|
|
|
|
tmp = substr(STR, j, 1);
|
|
|
|
if (j > 1) printf (",");
|
|
|
|
printf ("R.V.%s", X[str::tocharcode(tmp)]);
|
|
|
|
}
|
|
|
|
printf (") -- %s", STR);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-10-31 05:41:19 +00:00
|
|
|
}
|