1# usage: awk -f actionnm.awk pseudocode.h 2# 3BEGIN { "date" | getline 4 today = $0 5 printf("\n/* this file generated on %s */\n", today ) 6 printf("\nstatic char *action_names[] = { \n " ) 7 opl = 0 8} 9 10/^#define/ { 11 if ( opl > 3 ) { 12 printf("\n ") 13 opl = 0 14 } 15 opl = opl +1 16 t = sprintf("\"%s\"", $2 ) 17 printf("%-15s ,", t ) 18# printf("%-10s", $2 ) 19} 20 21END { 22 if ( opl > 3 ) { 23 printf("\n ") 24 } 25 printf("\t 0\n};\n\n") 26} 27 28