| 1 |
# Generate the VMS crtl map |
| 2 |
# Copyright (C) 2011-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
BEGIN { |
| 5 |
is_first = 1; |
| 6 |
maxlen=1; |
| 7 |
maxlen_name="??" |
| 8 |
prev="" |
| 9 |
ORS="" |
| 10 |
} |
| 11 |
|
| 12 |
# Remove comment and blank lines. |
| 13 |
/^ *#/ || /^ *$/ { |
| 14 |
next; |
| 15 |
} |
| 16 |
|
| 17 |
{ |
| 18 |
# Handle comma |
| 19 |
if (!is_first) |
| 20 |
print ",\n" |
| 21 |
else |
| 22 |
is_first = 0; |
| 23 |
|
| 24 |
# Check the map is sorted |
| 25 |
if ($0 <= prev) |
| 26 |
{ |
| 27 |
print "Map not sorted!! (with name " $0 ")\n" |
| 28 |
exit 1 |
| 29 |
} |
| 30 |
prev = $0 |
| 31 |
|
| 32 |
# Compute the max of the identifier len. |
| 33 |
l=length($1) |
| 34 |
if (l > maxlen) |
| 35 |
{ |
| 36 |
maxlen = l |
| 37 |
maxlen_name = $1 |
| 38 |
} |
| 39 |
|
| 40 |
print "{ \"" $1 "\", " |
| 41 |
if (NF == 1) |
| 42 |
print "0 }" |
| 43 |
else |
| 44 |
{ |
| 45 |
printf "VMS_CRTL_" $2 |
| 46 |
for (i = 3; i <= NF; i++) |
| 47 |
printf " | VMS_CRTL_" $i |
| 48 |
printf " }" |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
END { |
| 53 |
print "\n\n" |
| 54 |
print "#define VMS_CRTL_MAXLEN " maxlen " /*" maxlen_name " */\n" |
| 55 |
} |