Simple script to create node names for debugging
This commit is contained in:
parent
22e9b677fe
commit
59f04ac937
40
bin/sh/mknodenames.sh
Executable file
40
bin/sh/mknodenames.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#! /bin/sh
|
||||
|
||||
test -t 1 && test "$#" -eq 0 && exec > nodenames.h
|
||||
|
||||
echo "#ifdef DEBUG"
|
||||
echo '
|
||||
/*
|
||||
* Automatically generated by '"$0"'
|
||||
* DO NOT EDIT. Do Not "cvs add".
|
||||
*/
|
||||
'
|
||||
|
||||
MAX=$(awk < nodes.h '
|
||||
/#define/ {
|
||||
if ($3 > MAX) MAX = $3
|
||||
}
|
||||
END { print MAX }
|
||||
')
|
||||
|
||||
echo
|
||||
echo "STATIC const char * const NodeNames[${MAX} + 1] = {"
|
||||
|
||||
grep '^#define' nodes.h | sort -k2n | while read define name number opt_comment
|
||||
do
|
||||
: ${next:=0}
|
||||
while [ "$number" -gt "$next" ]
|
||||
do
|
||||
echo ' "???",'
|
||||
next=$(( next + 1))
|
||||
done
|
||||
echo ' "'"$name"'",'
|
||||
next=$(( number + 1 ))
|
||||
done
|
||||
|
||||
echo "};"
|
||||
echo
|
||||
echo '#define NODETYPENAME(type) \'
|
||||
echo ' ((unsigned)(type) <= '"${MAX}"' ? NodeNames[(type)] : "??OOR??")'
|
||||
echo
|
||||
echo '#endif'
|
Loading…
Reference in New Issue
Block a user