Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: third_party/sqlite/src/tool/mkopcodec.tcl

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/tool/mkmsvcmin.tcl ('k') | third_party/sqlite/src/tool/mkopcodeh.tcl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/tclsh 1 #!/usr/bin/tclsh
2 # 2 #
3 # This TCL script scans the opcodes.h file (which is itself generated by 3 # This TCL script scans the opcodes.h file (which is itself generated by
4 # another TCL script) and uses the information gleaned to create the 4 # another TCL script) and uses the information gleaned to create the
5 # opcodes.c source file. 5 # opcodes.c source file.
6 # 6 #
7 # Opcodes.c contains strings which are the symbolic names for the various 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 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. 9 # VDBE program during tracing or as a result of the EXPLAIN keyword.
10 # 10 #
11 puts "/* Automatically generated. Do not edit */" 11 puts "/* Automatically generated. Do not edit */"
12 puts "/* See the tool/mkopcodec.tcl script for details. */" 12 puts "/* See the tool/mkopcodec.tcl script for details. */"
13 puts "#if !defined(SQLITE_OMIT_EXPLAIN) \\" 13 puts "#if !defined(SQLITE_OMIT_EXPLAIN) \\"
14 puts " || defined(VDBE_PROFILE) \\" 14 puts " || defined(VDBE_PROFILE) \\"
15 puts " || defined(SQLITE_DEBUG)" 15 puts " || defined(SQLITE_DEBUG)"
16 puts "#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) || defined(SQLITE_DEBUG)" 16 puts "#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) || defined(SQLITE_DEBUG)"
17 puts "# define OpHelp(X) \"\\0\" X" 17 puts "# define OpHelp(X) \"\\0\" X"
18 puts "#else" 18 puts "#else"
19 puts "# define OpHelp(X)" 19 puts "# define OpHelp(X)"
20 puts "#endif" 20 puts "#endif"
21 puts "const char *sqlite3OpcodeName(int i)\173" 21 puts "const char *sqlite3OpcodeName(int i)\173"
22 puts " static const char *const azName\[\] = \173 \"?\"," 22 puts " static const char *const azName\[\] = \173"
23 set mx 0 23 set mx 0
24 24
25 set in [open [lindex $argv 0] rb] 25 set in [open [lindex $argv 0] rb]
26 while {![eof $in]} { 26 while {![eof $in]} {
27 set line [gets $in] 27 set line [gets $in]
28 if {[regexp {^#define OP_} $line]} { 28 if {[regexp {^#define OP_} $line]} {
29 set name [lindex $line 1] 29 set name [lindex $line 1]
30 regsub {^OP_} $name {} name 30 regsub {^OP_} $name {} name
31 set i [lindex $line 2] 31 set i [lindex $line 2]
32 set label($i) $name 32 set label($i) $name
33 if {$mx<$i} {set mx $i} 33 if {$mx<$i} {set mx $i}
34 if {[regexp {synopsis: (.*) \*/} $line all x]} { 34 if {[regexp {synopsis: (.*) \*/} $line all x]} {
35 set synopsis($i) [string trim $x] 35 set synopsis($i) [string trim $x]
36 } else { 36 } else {
37 set synopsis($i) {} 37 set synopsis($i) {}
38 } 38 }
39 } 39 }
40 } 40 }
41 close $in 41 close $in
42 42
43 for {set i 1} {$i<=$mx} {incr i} { 43 for {set i 0} {$i<=$mx} {incr i} {
44 puts [format " /* %3d */ %-18s OpHelp(\"%s\")," \ 44 puts [format " /* %3d */ %-18s OpHelp(\"%s\")," \
45 $i \"$label($i)\" $synopsis($i)] 45 $i \"$label($i)\" $synopsis($i)]
46 } 46 }
47 puts " \175;" 47 puts " \175;"
48 puts " return azName\[i\];" 48 puts " return azName\[i\];"
49 puts "\175" 49 puts "\175"
50 puts "#endif" 50 puts "#endif"
OLDNEW
« no previous file with comments | « third_party/sqlite/src/tool/mkmsvcmin.tcl ('k') | third_party/sqlite/src/tool/mkopcodeh.tcl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698