]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Convert the mkopcodec.awk script into tool/mkopcodec.tcl.
authordrh <drh@noemail.net>
Wed, 7 Oct 2015 12:11:36 +0000 (12:11 +0000)
committerdrh <drh@noemail.net>
Wed, 7 Oct 2015 12:11:36 +0000 (12:11 +0000)
FossilOrigin-Name: 1506cb33fcf61e2ef97b35b99e58fbf21f4f5496

Makefile.in
Makefile.msc
main.mk
manifest
manifest.uuid
mkopcodec.awk [deleted file]
tool/mkopcodec.tcl [new file with mode: 0644]

index 20c8420d34bf74980d1f68c51c6bb02dab4c209d..b78dbac1a208a1234ebfd8e04eb4975f59be177e 100644 (file)
@@ -899,8 +899,8 @@ tclsqlite3$(TEXE):  tclsqlite-shell.lo libsqlite3.la
 
 # Rules to build opcodes.c and opcodes.h
 #
-opcodes.c:     opcodes.h $(TOP)/mkopcodec.awk
-       $(NAWK) -f $(TOP)/mkopcodec.awk opcodes.h >opcodes.c
+opcodes.c:     opcodes.h $(TOP)/tool/mkopcodec.tcl
+       $(TCLSH_CMD) $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c
 
 opcodes.h:     parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl
        cat parse.h $(TOP)/src/vdbe.c | $(TCLSH_CMD) $(TOP)/tool/mkopcodeh.tcl >opcodes.h
index 124761757d178dc7f59ed5e103baeef97b0981f0..d21bab0d8e12fcc4f2667a433230be85acbb2801 100644 (file)
@@ -1572,8 +1572,8 @@ tclsqlite3.exe:   tclsqlite-shell.lo $(SQLITE3C) $(LIBRESOBJS)
 
 # Rules to build opcodes.c and opcodes.h
 #
-opcodes.c:     opcodes.h $(TOP)\mkopcodec.awk
-       $(NAWK) -f $(TOP)\mkopcodec.awk opcodes.h > opcodes.c
+opcodes.c:     opcodes.h $(TOP)\tool\mkopcodec.tcl
+       $(TCLSH_CMD) $(TOP)\tool\mkopcodec.tcl opcodes.h > opcodes.c
 
 opcodes.h:     parse.h $(TOP)\src\vdbe.c $(TOP)\tool\mkopcodeh.tcl
        type parse.h $(TOP)\src\vdbe.c | $(TCLSH_CMD) $(TOP)\tool\mkopcodeh.awk > opcodes.h
diff --git a/main.mk b/main.mk
index cc413faca25c027207769465281e316c4ab70270..9c7abf72773978249c1c74a58dc88b79c2297780 100644 (file)
--- a/main.mk
+++ b/main.mk
@@ -579,8 +579,8 @@ tclsqlite.o:        $(TOP)/src/tclsqlite.c $(HDR)
 
 # Rules to build opcodes.c and opcodes.h
 #
-opcodes.c:     opcodes.h $(TOP)/mkopcodec.awk
-       $(NAWK) -f $(TOP)/mkopcodec.awk opcodes.h >opcodes.c
+opcodes.c:     opcodes.h $(TOP)/tool/mkopcodec.tcl
+       tclsh $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c
 
 opcodes.h:     parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl
        cat parse.h $(TOP)/src/vdbe.c | \
index 1a4dd940953662895b6c95067a566a8ee896a878..b54e68ae0a7407c19a740f660c6b67a7d97eb233 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,9 +1,9 @@
-C Change\smkopcodeh.awk\sinto\stool/mkopcodeh.tcl.
-D 2015-10-07T02:52:09.315
+C Convert\sthe\smkopcodec.awk\sscript\sinto\stool/mkopcodec.tcl.
+D 2015-10-07T12:11:36.664
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
-F Makefile.in dd1f363468240142a5be1c9d58014dc9b8eae2f4
+F Makefile.in da829ae5a1f60e3ff7d76a979628ce4a1bfc5d7d
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
-F Makefile.msc 8fb99d7b4e8b2e812a2360b8356d956d26e0e953
+F Makefile.msc 5ae4a363bc7cfbd18814e077f67bb418e6e3378d
 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858
 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
 F VERSION ccfc4d1576dbfdeece0a4372a2e6a2e37d3e7975
@@ -263,8 +263,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e
 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
 F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
-F main.mk 9fe51a296a2550282db357d2b3825cc32fbc455b
-F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea
+F main.mk b67cb215800e4602744db3c6abdb77aac8adbf5e
 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
@@ -1351,6 +1350,7 @@ F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
 F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6
 F tool/mkautoconfamal.sh d1a2da0e15b2ed33d60af35c7e9d483f13a8eb9f
 F tool/mkkeywordhash.c dfff09dbbfaf950e89af294f48f902181b144670
+F tool/mkopcodec.tcl edde8adc42621b5e598127f8cdc6d52cfe21f52b
 F tool/mkopcodeh.tcl e04177031532b7aa9379ded50e820231ac4abd6e
 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
 F tool/mkpragmatab.tcl 84af2b180484323a2ea22a2279e8bd9e3e1e492e
@@ -1389,10 +1389,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 0abd65294e6e8db68e7ce6724f02f17ba1cb3422
-R 33730b016d975e72f95dcd99735ce552
-T *branch * omit-awk
-T *sym-omit-awk *
-T -sym-trunk *
+P ed0ebc460b54939862e3bddee2bb9bcb9f69c747
+R 725a0812f70e1ffeb50dd24066c3fbf1
 U drh
-Z 05cb2395dd6fc47d133085b2716a644b
+Z a24c1f360278b392b8819db30361ce0f
index 7bf1ca41d861c54dcc262b443270898e1cda2f8e..3254b996cd6f16241226524a94fd09e91a5fc988 100644 (file)
@@ -1 +1 @@
-ed0ebc460b54939862e3bddee2bb9bcb9f69c747
\ No newline at end of file
+1506cb33fcf61e2ef97b35b99e58fbf21f4f5496
\ No newline at end of file
diff --git a/mkopcodec.awk b/mkopcodec.awk
deleted file mode 100644 (file)
index de19068..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/awk -f
-#
-# This AWK script scans the opcodes.h file (which is itself generated by
-# another awk script) and uses the information gleaned to create the
-# opcodes.c source file.
-#
-# Opcodes.c contains strings which are the symbolic names for the various
-# opcodes used by the VDBE.  These strings are used when disassembling a
-# VDBE program during tracing or as a result of the EXPLAIN keyword.
-#
-BEGIN {
-  print "/* Automatically generated.  Do not edit */"
-  print "/* See the mkopcodec.awk script for details. */"
-  printf "#if !defined(SQLITE_OMIT_EXPLAIN)"
-  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_/ {
-  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 */ %-18s OpHelp(\"%s\"),\n", i, \
-        "\"" label[i] "\"", synopsis[i]
-  }
-  print "  };"
-  print "  return azName[i];"
-  print "}"
-  print "#endif"
-}
diff --git a/tool/mkopcodec.tcl b/tool/mkopcodec.tcl
new file mode 100644 (file)
index 0000000..55d828b
--- /dev/null
@@ -0,0 +1,50 @@
+#!/usr/bin/tclsh
+#
+# This TCL script scans the opcodes.h file (which is itself generated by
+# another TCL script) and uses the information gleaned to create the
+# opcodes.c source file.
+#
+# Opcodes.c contains strings which are the symbolic names for the various
+# opcodes used by the VDBE.  These strings are used when disassembling a
+# VDBE program during tracing or as a result of the EXPLAIN keyword.
+#
+puts "/* Automatically generated.  Do not edit */"
+puts "/* See the tool/mkopcodec.tcl script for details. */"
+puts "#if !defined(SQLITE_OMIT_EXPLAIN) \\"
+puts " || defined(VDBE_PROFILE) \\"
+puts " || defined(SQLITE_DEBUG)"
+puts "#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) || defined(SQLITE_DEBUG)"
+puts "# define OpHelp(X) \"\\0\" X"
+puts "#else"
+puts "# define OpHelp(X)"
+puts "#endif"
+puts "const char *sqlite3OpcodeName(int i)\173"
+puts " static const char *const azName\[\] = \173 \"?\","
+set mx 0
+
+set in [open [lindex $argv 0] rb]
+while {![eof $in]} {
+  set line [gets $in]
+  if {[regexp {^#define OP_} $line]} {
+    set name [lindex $line 1]
+    regsub {^OP_} $name {} name
+    set i [lindex $line 2]
+    set label($i) $name
+    if {$mx<$i} {set mx $i}
+    if {[regexp {synopsis: (.*) \*/} $line all x]} {
+      set synopsis($i) [string trim $x]
+    } else {
+      set synopsis($i) {}
+    }
+  }
+}
+close $in
+
+for {set i 1} {$i<=$mx} {incr i} {
+  puts [format "    /* %3d */ %-18s OpHelp(\"%s\")," \
+         $i \"$label($i)\" $synopsis($i)]
+}
+puts "  \175;"
+puts "  return azName\[i\];"
+puts "\175"
+puts "#endif"