]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Change the addopcodes.awk script into tool/addopcodes.tcl.
authordrh <drh@noemail.net>
Wed, 7 Oct 2015 12:21:14 +0000 (12:21 +0000)
committerdrh <drh@noemail.net>
Wed, 7 Oct 2015 12:21:14 +0000 (12:21 +0000)
FossilOrigin-Name: 8bbf37142ef2759274668f6da114b5c8072e42db

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

index b78dbac1a208a1234ebfd8e04eb4975f59be177e..eae80ece5e3dd54478f06c253db49f6aa392a8db 100644 (file)
@@ -909,12 +909,12 @@ opcodes.h:        parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl
 #
 parse.h:       parse.c
 
-parse.c:       $(TOP)/src/parse.y lemon$(BEXE) $(TOP)/addopcodes.awk
+parse.c:       $(TOP)/src/parse.y lemon$(BEXE) $(TOP)/tool/addopcodes.tcl
        cp $(TOP)/src/parse.y .
        rm -f parse.h
        ./lemon$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
        mv parse.h parse.h.temp
-       $(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
+       $(TCLSH_CMD) $(TOP)/tool/addopcodes.tcl parse.h.temp >parse.h
 
 sqlite3.h:     $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION
        $(TCLSH_CMD) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
index d21bab0d8e12fcc4f2667a433230be85acbb2801..785c65cb712a33f6bdd425e8be21132ef14329d0 100644 (file)
@@ -1582,12 +1582,12 @@ opcodes.h:      parse.h $(TOP)\src\vdbe.c $(TOP)\tool\mkopcodeh.tcl
 #
 parse.h:       parse.c
 
-parse.c:       $(TOP)\src\parse.y lemon.exe $(TOP)\addopcodes.awk
+parse.c:       $(TOP)\src\parse.y lemon.exe $(TOP)\tool\addopcodes.tcl
        del /Q parse.y parse.h parse.h.temp 2>NUL
        copy $(TOP)\src\parse.y .
        .\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
        move parse.h parse.h.temp
-       $(NAWK) -f $(TOP)\addopcodes.awk parse.h.temp > parse.h
+       $(TCLSH_CMD) $(TOP)\tool\addopcodes.tcl parse.h.temp > parse.h
 
 sqlite3.h:     $(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION
        $(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > sqlite3.h
diff --git a/addopcodes.awk b/addopcodes.awk
deleted file mode 100644 (file)
index dcd31ef..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/awk
-#
-# This script appends additional token codes to the end of the
-# parse.h file that lemon generates.  These extra token codes are
-# not used by the parser.  But they are used by the tokenizer and/or
-# the code generator.
-#
-#
-BEGIN {
-  max = 0
-}
-/^#define TK_/ {
-  print $0
-  if( max<$3 ) max = $3
-}
-END {
-  printf "#define TK_%-29s %4d\n", "TO_TEXT",         ++max
-  printf "#define TK_%-29s %4d\n", "TO_BLOB",         ++max
-  printf "#define TK_%-29s %4d\n", "TO_NUMERIC",      ++max
-  printf "#define TK_%-29s %4d\n", "TO_INT",          ++max
-  printf "#define TK_%-29s %4d\n", "TO_REAL",         ++max
-  printf "#define TK_%-29s %4d\n", "ISNOT",           ++max
-  printf "#define TK_%-29s %4d\n", "END_OF_FILE",     ++max
-  printf "#define TK_%-29s %4d\n", "ILLEGAL",         ++max
-  printf "#define TK_%-29s %4d\n", "SPACE",           ++max
-  printf "#define TK_%-29s %4d\n", "UNCLOSED_STRING", ++max
-  printf "#define TK_%-29s %4d\n", "FUNCTION",        ++max
-  printf "#define TK_%-29s %4d\n", "COLUMN",          ++max
-  printf "#define TK_%-29s %4d\n", "AGG_FUNCTION",    ++max
-  printf "#define TK_%-29s %4d\n", "AGG_COLUMN",      ++max
-  printf "#define TK_%-29s %4d\n", "UMINUS",          ++max
-  printf "#define TK_%-29s %4d\n", "UPLUS",           ++max
-  printf "#define TK_%-29s %4d\n", "REGISTER",        ++max
-}
diff --git a/main.mk b/main.mk
index 9c7abf72773978249c1c74a58dc88b79c2297780..f3c1d2aabdebba2c47a048143ab4128f210d4b20 100644 (file)
--- a/main.mk
+++ b/main.mk
@@ -590,12 +590,12 @@ opcodes.h:        parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl
 #
 parse.h:       parse.c
 
-parse.c:       $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk
+parse.c:       $(TOP)/src/parse.y lemon $(TOP)/tool/addopcodes.tcl
        cp $(TOP)/src/parse.y .
        rm -f parse.h
        ./lemon -s $(OPTS) parse.y
        mv parse.h parse.h.temp
-       $(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
+       tclsh $(TOP)/tool/addopcodes.tcl parse.h.temp >parse.h
 
 sqlite3.h:     $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION $(TOP)/ext/rtree/sqlite3rtree.h
        tclsh $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
index b54e68ae0a7407c19a740f660c6b67a7d97eb233..a38c009e00e2755a2ef568f54c6b306c82fd03fe 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,14 +1,13 @@
-C Convert\sthe\smkopcodec.awk\sscript\sinto\stool/mkopcodec.tcl.
-D 2015-10-07T12:11:36.664
+C Change\sthe\saddopcodes.awk\sscript\sinto\stool/addopcodes.tcl.
+D 2015-10-07T12:21:14.000
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
-F Makefile.in da829ae5a1f60e3ff7d76a979628ce4a1bfc5d7d
+F Makefile.in b33d44230974d2d5ea2f0599855c5e36bd79b90a
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
-F Makefile.msc 5ae4a363bc7cfbd18814e077f67bb418e6e3378d
+F Makefile.msc b7d8a7efbbf38cee57bfc81d11ca28c42122ff81
 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858
 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
 F VERSION ccfc4d1576dbfdeece0a4372a2e6a2e37d3e7975
 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
-F addopcodes.awk 9eb448a552d5c0185cf62c463f9c173cedae3811
 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
@@ -263,7 +262,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e
 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
 F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
-F main.mk b67cb215800e4602744db3c6abdb77aac8adbf5e
+F main.mk 1cb544e1b1943b8b6452a811869b3baee5bfcb13
 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
@@ -1334,6 +1333,7 @@ F test/without_rowid6.test 1f99644e6508447fb050f73697350c7ceca3392e
 F test/wordcount.c 9915e06cb33d8ca8109b8700791afe80d305afda
 F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa
 F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac
+F tool/addopcodes.tcl 7cc82ecca456a6b3148abf492b0419b83140881a
 F tool/build-all-msvc.bat 761d8c82a1a529261291812732a853a1b4256d85 x
 F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367
 F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2
@@ -1389,7 +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 ed0ebc460b54939862e3bddee2bb9bcb9f69c747
-R 725a0812f70e1ffeb50dd24066c3fbf1
+P 1506cb33fcf61e2ef97b35b99e58fbf21f4f5496
+R d8eeb7e51eba4dfb24803600079d2858
 U drh
-Z a24c1f360278b392b8819db30361ce0f
+Z f02ffe1dfbcccf71e8c30b4fbe822892
index 3254b996cd6f16241226524a94fd09e91a5fc988..95ca593f479d483f6737f1921bb048720a53c31c 100644 (file)
@@ -1 +1 @@
-1506cb33fcf61e2ef97b35b99e58fbf21f4f5496
\ No newline at end of file
+8bbf37142ef2759274668f6da114b5c8072e42db
\ No newline at end of file
diff --git a/tool/addopcodes.tcl b/tool/addopcodes.tcl
new file mode 100644 (file)
index 0000000..46675cb
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/tclsh
+#
+# This script appends additional token codes to the end of the
+# parse.h file that lemon generates.  These extra token codes are
+# not used by the parser.  But they are used by the tokenizer and/or
+# the code generator.
+#
+#
+set in [open [lindex $argv 0] rb]
+set max 0
+while {![eof $in]} {
+  set line [gets $in]
+  if {[regexp {^#define TK_} $line]} {
+    puts $line
+    set x [lindex $line 2]
+    if {$x>$max} {set max $x}
+  }
+}
+close $in
+
+# The following are the extra token codes to be added
+#
+set extras {
+  TO_TEXT
+  TO_BLOB
+  TO_NUMERIC
+  TO_INT
+  TO_REAL
+  ISNOT
+  END_OF_FILE
+  ILLEGAL
+  SPACE
+  UNCLOSED_STRING
+  FUNCTION
+  COLUMN
+  AGG_FUNCTION
+  AGG_COLUMN
+  UMINUS
+  UPLUS
+  REGISTER
+}
+foreach x $extras {
+  incr max
+  puts [format "#define TK_%-29s %4d" $x $max]
+}