drh | b327f77 | 2004-10-06 15:03:57 +0000 | [diff] [blame] | 1 | #!/usr/bin/awk -f |
| 2 | # |
| 3 | # This AWK script scans the opcodes.h file (which is itself generated by |
| 4 | # another awk script) and uses the information gleaned to create the |
| 5 | # opcodes.c source file. |
| 6 | # |
| 7 | # Opcodes.c contains strings which are the symbolic names for the various |
| 8 | # opcodes used by the VDBE. These strings are used when disassembling a |
| 9 | # VDBE program during tracing or as a result of the EXPLAIN keyword. |
| 10 | # |
| 11 | BEGIN { |
| 12 | print "/* Automatically generated. Do not edit */" |
drh | 279d477 | 2005-01-20 23:23:29 +0000 | [diff] [blame] | 13 | print "/* See the mkopcodec.awk script for details. */" |
drh | b7f9164 | 2004-10-31 02:22:47 +0000 | [diff] [blame] | 14 | printf "#if !defined(SQLITE_OMIT_EXPLAIN)" |
| 15 | printf " || !defined(NDEBUG)" |
| 16 | printf " || defined(VDBE_PROFILE)" |
| 17 | print " || defined(SQLITE_DEBUG)" |
drh | 5719628 | 2004-10-06 15:41:16 +0000 | [diff] [blame] | 18 | print "const char *const sqlite3OpcodeNames[] = { \"?\"," |
drh | b327f77 | 2004-10-06 15:03:57 +0000 | [diff] [blame] | 19 | } |
drh | daa28ff | 2004-12-10 17:17:18 +0000 | [diff] [blame] | 20 | /define OP_/ { |
drh | b327f77 | 2004-10-06 15:03:57 +0000 | [diff] [blame] | 21 | sub("OP_","",$2) |
drh | daa28ff | 2004-12-10 17:17:18 +0000 | [diff] [blame] | 22 | i++ |
| 23 | printf " /* %3d */ \"%s\",\n", $3, $2 |
drh | b327f77 | 2004-10-06 15:03:57 +0000 | [diff] [blame] | 24 | } |
| 25 | END { |
| 26 | print "};" |
drh | b7f9164 | 2004-10-31 02:22:47 +0000 | [diff] [blame] | 27 | print "#endif" |
drh | b327f77 | 2004-10-06 15:03:57 +0000 | [diff] [blame] | 28 | } |