summaryrefslogtreecommitdiff
path: root/mkopcodec.awk
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@eds.org>2014-10-16 22:51:35 -0400
committerHans-Christoph Steiner <hans@eds.org>2014-10-16 22:51:35 -0400
commit569c6676a6ddb0ff73821d7693b5e18ddef809b9 (patch)
tree833538da7bba39105daff45e265aef386a200acd /mkopcodec.awk
parent08119c361d1181b3e8f1abb429236e488a664753 (diff)
Imported Upstream version 3.2.0upstream
Diffstat (limited to 'mkopcodec.awk')
-rw-r--r--mkopcodec.awk20
1 files changed, 17 insertions, 3 deletions
diff --git a/mkopcodec.awk b/mkopcodec.awk
index 2ef77d4..de19068 100644
--- a/mkopcodec.awk
+++ b/mkopcodec.awk
@@ -12,22 +12,36 @@ BEGIN {
print "/* Automatically generated. Do not edit */"
print "/* See the mkopcodec.awk script for details. */"
printf "#if !defined(SQLITE_OMIT_EXPLAIN)"
- printf " || !defined(NDEBUG)"
printf " || defined(VDBE_PROFILE)"
print " || defined(SQLITE_DEBUG)"
+ print "#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) || defined(SQLITE_DEBUG)"
+ print "# define OpHelp(X) \"\\0\" X"
+ print "#else"
+ print "# define OpHelp(X)"
+ print "#endif"
print "const char *sqlite3OpcodeName(int i){"
print " static const char *const azName[] = { \"?\","
mx = 0
}
-/define OP_/ {
+/^.define OP_/ {
sub("OP_","",$2)
i = $3+0
label[i] = $2
if( mx<i ) mx = i
+ for(j=5; j<NF; j++) if( $j=="synopsis:" ) break
+ if( j<NF ){
+ j++
+ x = $j
+ for(j=j+1; j<NF; j++) x = x " " $j
+ synopsis[i] = x
+ }else{
+ synopsis[i] = ""
+ }
}
END {
for(i=1; i<=mx; i++){
- printf " /* %3d */ \"%s\",\n", i, label[i]
+ printf " /* %3d */ %-18s OpHelp(\"%s\"),\n", i, \
+ "\"" label[i] "\"", synopsis[i]
}
print " };"
print " return azName[i];"