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

Unified Diff: third_party/sqlite/src/tool/mkpragmatab.tcl

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/tool/mkopcodeh.tcl ('k') | third_party/sqlite/src/tool/mksqlite3c.tcl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/tool/mkpragmatab.tcl
diff --git a/third_party/sqlite/src/tool/mkpragmatab.tcl b/third_party/sqlite/src/tool/mkpragmatab.tcl
index aa7c8078c556446a10dea6e8a5a39d4781329681..145a365c54e66ad85850e184cf6fc870e54f2c82 100644
--- a/third_party/sqlite/src/tool/mkpragmatab.tcl
+++ b/third_party/sqlite/src/tool/mkpragmatab.tcl
@@ -4,10 +4,10 @@
#
# To add new pragmas, first add the name and other relevant attributes
# of the pragma to the "pragma_def" object below. Then run this script
-# to generate the C-code for the lookup table and copy/paste the output
-# of this script into the appropriate spot in the pragma.c source file.
+# to generate the ../src/pragma.h header file that contains macros and
+# the lookup table needed for pragma name lookup in the pragma.c module.
# Then add the extra "case PragTyp_XXXXX:" and subsequent code for the
-# new pragma.
+# new pragma in ../src/pragma.c.
#
set pragma_def {
@@ -47,8 +47,6 @@ set pragma_def {
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
NAME: cache_spill
- TYPE: FLAG
- ARG: SQLITE_CacheSpill
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
NAME: reverse_unordered_selects
@@ -136,6 +134,10 @@ set pragma_def {
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
+ NAME: cell_size_check
+ TYPE: FLAG
+ ARG: SQLITE_CellSizeCk
+
NAME: default_cache_size
FLAG: NeedSchema
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
@@ -205,6 +207,14 @@ set pragma_def {
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
NAME: index_info
+ TYPE: INDEX_INFO
+ ARG: 0
+ FLAG: NeedSchema
+ IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
+
+ NAME: index_xinfo
+ TYPE: INDEX_INFO
+ ARG: 1
FLAG: NeedSchema
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
@@ -228,7 +238,7 @@ set pragma_def {
IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
NAME: parser_trace
- IF: defined(SQLITE_DEBUG)
+ IF: defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE)
NAME: case_sensitive_like
@@ -246,18 +256,29 @@ set pragma_def {
NAME: schema_version
TYPE: HEADER_VALUE
+ ARG: BTREE_SCHEMA_VERSION
IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
NAME: user_version
TYPE: HEADER_VALUE
+ ARG: BTREE_USER_VERSION
+ IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
+
+ NAME: data_version
+ TYPE: HEADER_VALUE
+ ARG: BTREE_DATA_VERSION
+ FLAG: ReadOnly
IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
NAME: freelist_count
TYPE: HEADER_VALUE
+ ARG: BTREE_FREE_PAGE_COUNT
+ FLAG: ReadOnly
IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
NAME: application_id
TYPE: HEADER_VALUE
+ ARG: BTREE_APPLICATION_ID
IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
NAME: compile_options
@@ -297,7 +318,20 @@ set pragma_def {
NAME: threads
}
-fconfigure stdout -translation lf
+
+# Open the output file
+#
+set destfile "[file dir [file dir [file normal $argv0]]]/src/pragma.h"
+puts "Overwriting $destfile with new pragma table..."
+set fd [open $destfile wb]
+puts $fd {/* DO NOT EDIT!
+** This file is automatically generated by the script at
+** ../tool/mkpragmatab.tcl. To update the set of pragmas, edit
+** that script and rerun it.
+*/}
+
+# Parse the PRAGMA table above.
+#
set name {}
set type {}
set if {}
@@ -351,7 +385,7 @@ foreach name $allnames {
set if [lindex $allbyname($name) 2]
if {[regexp SQLITE_DEBUG $if] || [regexp SQLITE_HAS_CODEC $if]} continue
set seentype($type) 1
- puts [format {#define %-35s %4d} PragTyp_$type $pnum]
+ puts $fd [format {#define %-35s %4d} PragTyp_$type $pnum]
incr pnum
}
foreach name $allnames {
@@ -360,14 +394,14 @@ foreach name $allnames {
set if [lindex $allbyname($name) 2]
if {[regexp SQLITE_DEBUG $if]} continue
set seentype($type) 1
- puts [format {#define %-35s %4d} PragTyp_$type $pnum]
+ puts $fd [format {#define %-35s %4d} PragTyp_$type $pnum]
incr pnum
}
foreach name $allnames {
set type [lindex $allbyname($name) 0]
if {[info exists seentype($type)]} continue
set seentype($type) 1
- puts [format {#define %-35s %4d} PragTyp_$type $pnum]
+ puts $fd [format {#define %-35s %4d} PragTyp_$type $pnum]
incr pnum
}
@@ -375,18 +409,18 @@ foreach name $allnames {
#
set fv 1
foreach f [lsort [array names allflags]] {
- puts [format {#define PragFlag_%-20s 0x%02x} $f $fv]
+ puts $fd [format {#define PragFlag_%-20s 0x%02x} $f $fv]
set fv [expr {$fv*2}]
}
# Generate the lookup table
#
-puts "static const struct sPragmaNames \173"
-puts " const char *const zName; /* Name of pragma */"
-puts " u8 ePragTyp; /* PragTyp_XXX value */"
-puts " u8 mPragFlag; /* Zero or more PragFlag_XXX values */"
-puts " u32 iArg; /* Extra argument */"
-puts "\175 aPragmaNames\[\] = \173"
+puts $fd "static const struct sPragmaNames \173"
+puts $fd " const char *const zName; /* Name of pragma */"
+puts $fd " u8 ePragTyp; /* PragTyp_XXX value */"
+puts $fd " u8 mPragFlag; /* Zero or more PragFlag_XXX values */"
+puts $fd " u32 iArg; /* Extra argument */"
+puts $fd "\175 aPragmaNames\[\] = \173"
set current_if {}
set spacer [format { %26s } {}]
@@ -395,13 +429,13 @@ foreach name $allnames {
if {$if!=$current_if} {
if {$current_if!=""} {
foreach this_if $current_if {
- puts "#endif"
+ puts $fd "#endif"
}
}
set current_if $if
if {$current_if!=""} {
foreach this_if $current_if {
- puts "#if $this_if"
+ puts $fd "#if $this_if"
}
}
}
@@ -411,17 +445,17 @@ foreach name $allnames {
} else {
set flagx PragFlag_[join $flag {|PragFlag_}]
}
- puts " \173 /* zName: */ \"$name\","
- puts " /* ePragTyp: */ PragTyp_$type,"
- puts " /* ePragFlag: */ $flagx,"
- puts " /* iArg: */ $arg \175,"
+ puts $fd " \173 /* zName: */ \"$name\","
+ puts $fd " /* ePragTyp: */ PragTyp_$type,"
+ puts $fd " /* ePragFlag: */ $flagx,"
+ puts $fd " /* iArg: */ $arg \175,"
}
if {$current_if!=""} {
foreach this_if $current_if {
- puts "#endif"
+ puts $fd "#endif"
}
}
-puts "\175;"
+puts $fd "\175;"
# count the number of pragmas, for information purposes
#
@@ -433,4 +467,4 @@ foreach name $allnames {
if {[regexp {^defined} $if] || [regexp {[^!]defined} $if]} continue
incr dfltcnt
}
-puts "/* Number of pragmas: $dfltcnt on by default, $allcnt total. */"
+puts $fd "/* Number of pragmas: $dfltcnt on by default, $allcnt total. */"
« no previous file with comments | « third_party/sqlite/src/tool/mkopcodeh.tcl ('k') | third_party/sqlite/src/tool/mksqlite3c.tcl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698