# 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"); printf ("\t\t\%-20s: constant Code := %d; -- Code'First\n", "EOF", -1); } { t = sprintf ("%c", NR - 1); if (str::isprint(t)) t = " -- " t; else t=""; printf ("\t\t%-20s: constant Code := %d;%s\n", $1, NR-1, t); 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"); 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); } }