diff options
Diffstat (limited to 'chromium/third_party/sqlite/src/tool/mkctimec.tcl')
-rwxr-xr-x[-rw-r--r--] | chromium/third_party/sqlite/src/tool/mkctimec.tcl | 125 |
1 files changed, 78 insertions, 47 deletions
diff --git a/chromium/third_party/sqlite/src/tool/mkctimec.tcl b/chromium/third_party/sqlite/src/tool/mkctimec.tcl index 6294609451d..745a59a229c 100644..100755 --- a/chromium/third_party/sqlite/src/tool/mkctimec.tcl +++ b/chromium/third_party/sqlite/src/tool/mkctimec.tcl @@ -5,9 +5,82 @@ # const char **azCompileOpt[] # # definition used in src/ctime.c, run this script from -# the checkout root. It alters src/ctime.c in-place. +# the checkout root. It generates src/ctime.c . # + +set ::headWarning {/* DO NOT EDIT! +** This file is automatically generated by the script in the canonical +** SQLite source tree at tool/mkctimec.tcl. +** +** To modify this header, edit any of the various lists in that script +** which specify categories of generated conditionals in this file. +*/} + +# Make { and } easier to put into literals (even on EBCDIC machines.) +regexp {(\{)(\})} "{}" ma ::lb ::rb + +set ::headCode " +/* +** 2010 February 23 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file implements routines used to report what compile-time options +** SQLite was built with. +*/ +#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS /* IMP: R-16824-07538 */ + +/* +** Include the configuration header output by 'configure' if we're using the +** autoconf-based build +*/ +#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) +#include \"config.h\" +#define SQLITECONFIG_H 1 +#endif + +/* These macros are provided to \"stringify\" the value of the define +** for those options in which the value is meaningful. */ +#define CTIMEOPT_VAL_(opt) #opt +#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt) + +/* Like CTIMEOPT_VAL, but especially for SQLITE_DEFAULT_LOOKASIDE. This +** option requires a separate macro because legal values contain a single +** comma. e.g. (-DSQLITE_DEFAULT_LOOKASIDE=\"100,100\") */ +#define CTIMEOPT_VAL2_(opt1,opt2) #opt1 \",\" #opt2 +#define CTIMEOPT_VAL2(opt) CTIMEOPT_VAL2_(opt) +#include \"sqliteInt.h\" + +/* +** An array of names of all compile-time options. This array should +** be sorted A-Z. +** +** This array looks large, but in a typical installation actually uses +** only a handful of compile-time options, so most times this array is usually +** rather short and uses little memory space. +*/ +static const char * const sqlite3azCompileOpt\[\] = $::lb +" + +set ::tailCode " +$::rb ; + +const char **sqlite3CompileOptions(int *pnOpt){ + *pnOpt = sizeof(sqlite3azCompileOpt) / sizeof(sqlite3azCompileOpt\[0\]); + return (const char**)sqlite3azCompileOpt; +} + +#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ +" + # All Boolean compile time options which default to something # other than 0 or empty. The default is paired with the PP # symbol so that a differing define can be detected. @@ -70,7 +143,6 @@ set boolean_defnil_options { SQLITE_ENABLE_HIDDEN_COLUMNS SQLITE_ENABLE_ICU SQLITE_ENABLE_IOTRACE - SQLITE_ENABLE_JSON1 SQLITE_ENABLE_LOAD_EXTENSION SQLITE_ENABLE_LOCKING_STYLE SQLITE_ENABLE_MATH_FUNCTIONS @@ -151,6 +223,7 @@ set boolean_defnil_options { SQLITE_OMIT_INCRBLOB SQLITE_OMIT_INTEGRITY_CHECK SQLITE_OMIT_INTROSPECTION_PRAGMAS + SQLITE_OMIT_JSON SQLITE_OMIT_LIKE_OPTIMIZATION SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_LOCALTIME @@ -354,60 +427,18 @@ foreach v $value2_options { }] } -# Split a string on a regex, return all parts in order. -# Any elements with an even index may be empty. -# Elements with odd indices will match the regex. -proc split_on_re {re str {nrepps 1}} { - set chunks {} - set cix 0 - set resm [regexp -all -inline -indices $re $str] - if {[llength $resm]==0} { - return $str - } - set rix 0 - while {$rix < [llength $resm]} { - set mre [lindex $resm $rix] - incr rix $nrepps - set mbx [lindex $mre 0] - set mex [lindex $mre 1] - lappend chunks [string range $str $cix [expr $mbx - 1]] - lappend chunks [string range $str $mbx $mex] - set cix [expr $mex + 1] - } - lappend chunks [string range $str $cix end] - return $chunks -} - - set ctime_c "src/ctime.c" -if {[catch {set cfd [open $ctime_c r]}]!=0} { - puts stderr "File '$ctime_c' unreadable. Run this script from checkout root." - exit 1; -} - -set ctfc [read $cfd] -close $cfd - -set re {/\*\s+\*+\s*((BEGIN)|(END)) CODE GENERATED BY (\S+)\s+\*/\s+} -set renpp 5 - -set ctfcChunks [split_on_re $re $ctfc $renpp] -if {[llength $ctfcChunks] != 5} { - puts stderr "File '$ctime_c' has too few generated code markers." - exit 1; -} if {[catch {set cfd [open $ctime_c w]}]!=0} { puts stderr "File '$ctime_c' unwritable." exit 1; } -puts -nonewline $cfd [lindex $ctfcChunks 0] -puts -nonewline $cfd [lindex $ctfcChunks 1] +puts $cfd $::headWarning; +puts $cfd $::headCode; foreach o [lsort [array names options]] { puts $cfd [string trim $options($o)] } -puts -nonewline $cfd [lindex $ctfcChunks 3] -puts -nonewline $cfd [lindex $ctfcChunks 4] +puts -nonewline $cfd $::tailCode; close $cfd |