mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Merge all the enhancements and bug fixes from trunk, since none are
destablizing. Call this the second beta. FossilOrigin-Name: fb3ee1b7cac09e4950e4f48b44c277e4f391cb6c8f069644732d2389ca653da4
This commit is contained in:
93
tool/mkccode.tcl
Executable file
93
tool/mkccode.tcl
Executable file
@ -0,0 +1,93 @@
|
||||
#!/usr/bin/tclsh
|
||||
#
|
||||
# Use this script to build C-language source code for a program that uses
|
||||
# tclsqlite.c together with custom TCL scripts and/or C extensions for
|
||||
# either SQLite or TCL.
|
||||
#
|
||||
# Usage example:
|
||||
#
|
||||
# tclsh mktclsqliteprog.tcl demoapp.c.in >demoapp.c
|
||||
#
|
||||
# The demoapp.c.in file contains a mixture of C code, TCL script, and
|
||||
# processing directives used by mktclsqliteprog.tcl to build the final C-code
|
||||
# output file. Most lines of demoapp.c.in are copied straight through into
|
||||
# the output. The following control directives are recognized:
|
||||
#
|
||||
# BEGIN_STRING
|
||||
#
|
||||
# This marks the beginning of large string literal - usually a TCL
|
||||
# script of some kind. Subsequent lines of text through the first
|
||||
# line that begins with END_STRING are converted into a C-language
|
||||
# string literal.
|
||||
#
|
||||
# INCLUDE path
|
||||
#
|
||||
# The path argument is the name of a file to be inserted in place of
|
||||
# the INCLUDE line. The path can begin with $ROOT to signify the
|
||||
# root of the SQLite source tree, or $HOME to signify the directory
|
||||
# that contains the demoapp.c.in input script itself. If the path does
|
||||
# not begin with either $ROOT or $HOME, then it is interpreted relative
|
||||
# to the current working directory.
|
||||
#
|
||||
# If the INCLUDE occurs in the middle of BEGIN_STRING...END_STRING
|
||||
# then all of the text in the input file is converted into C-language
|
||||
# string literals.
|
||||
#
|
||||
# None of the control directives described above will nest. Only the
|
||||
# top-level input file ("demoapp.c.in" in the example) is interpreted.
|
||||
# referenced files are copied verbatim.
|
||||
#
|
||||
if {[llength $argv]!=1} {
|
||||
puts stderr "Usage: $argv0 TEMPLATE >OUTPUT"
|
||||
exit 1
|
||||
}
|
||||
set infile [lindex $argv 0]
|
||||
set ROOT [file normalize [file dir $argv0]/..]
|
||||
set HOME [file normalize [file dir $infile]]
|
||||
set in [open $infile rb]
|
||||
puts [subst {/* DO NOT EDIT
|
||||
**
|
||||
** This file was generated by \"$argv0 $infile\".
|
||||
** To make changes, edit $infile then rerun the generator
|
||||
** command.
|
||||
*/}]
|
||||
set instr 0
|
||||
while {1} {
|
||||
set line [gets $in]
|
||||
if {[eof $in]} break
|
||||
if {[regexp {^INCLUDE (.*)} $line all path]} {
|
||||
regsub {^\$ROOT\y} $path $ROOT path
|
||||
regsub {^\$HOME\y} $path $HOME path
|
||||
set in2 [open $path rb]
|
||||
puts "/* INCLUDE $path */"
|
||||
if {$instr} {
|
||||
while {1} {
|
||||
set line [gets $in2]
|
||||
if {[eof $in2]} break
|
||||
set x [string map "\\\\ \\\\\\\\ \\\" \\\\\"" $line]
|
||||
puts "\"$x\\n\""
|
||||
}
|
||||
} else {
|
||||
puts [read $in2]
|
||||
}
|
||||
puts "/* END $path */"
|
||||
close $in2
|
||||
continue
|
||||
}
|
||||
if {[regexp {^BEGIN_STRING} $line]} {
|
||||
set instr 1
|
||||
puts "/* BEGIN_STRING */"
|
||||
continue
|
||||
}
|
||||
if {[regexp {^END_STRING} $line]} {
|
||||
set instr 0
|
||||
puts "/* END_STRING */"
|
||||
continue
|
||||
}
|
||||
if {$instr} {
|
||||
set x [string map "\\\\ \\\\\\\\ \\\" \\\\\"" $line]
|
||||
puts "\"$x\\n\""
|
||||
} else {
|
||||
puts $line
|
||||
}
|
||||
}
|
@ -394,6 +394,7 @@ foreach file {
|
||||
fts3_icu.c
|
||||
sqlite3rbu.c
|
||||
dbstat.c
|
||||
dbpage.c
|
||||
sqlite3session.c
|
||||
json1.c
|
||||
fts5.c
|
||||
|
@ -15,6 +15,7 @@ set END {^/\*+ End of %s \*+/}
|
||||
|
||||
set in [open sqlite3.c]
|
||||
set out1 [open sqlite3-all.c w]
|
||||
fconfigure $out1 -translation lf
|
||||
|
||||
# Copy the header from sqlite3.c into sqlite3-all.c
|
||||
#
|
||||
@ -48,6 +49,7 @@ proc write_one_file {content} {
|
||||
global filecnt
|
||||
incr filecnt
|
||||
set out [open sqlite3-$filecnt.c w]
|
||||
fconfigure $out -translation lf
|
||||
puts -nonewline $out $content
|
||||
close $out
|
||||
puts $::out1 "#include \"sqlite3-$filecnt.c\""
|
||||
|
27
tool/sqlite3_analyzer.c.in
Normal file
27
tool/sqlite3_analyzer.c.in
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
** Read an SQLite database file and analyze its space utilization. Generate
|
||||
** text on standard output.
|
||||
*/
|
||||
#define TCLSH_INIT_PROC sqlite3_analyzer_init_proc
|
||||
#define SQLITE_ENABLE_DBSTAT_VTAB 1
|
||||
#undef SQLITE_THREADSAFE
|
||||
#define SQLITE_THREADSAFE 0
|
||||
#undef SQLITE_ENABLE_COLUMN_METADATA
|
||||
#define SQLITE_OMIT_DECLTYPE 1
|
||||
#define SQLITE_OMIT_DEPRECATED 1
|
||||
#define SQLITE_OMIT_PROGRESS_CALLBACK 1
|
||||
#define SQLITE_OMIT_SHARED_CACHE 1
|
||||
#define SQLITE_DEFAULT_MEMSTATUS 0
|
||||
#define SQLITE_MAX_EXPR_DEPTH 0
|
||||
#define SQLITE_OMIT_LOAD_EXTENSION 1
|
||||
INCLUDE sqlite3.c
|
||||
INCLUDE $ROOT/src/tclsqlite.c
|
||||
|
||||
const char *sqlite3_analyzer_init_proc(Tcl_Interp *interp){
|
||||
(void)interp;
|
||||
return
|
||||
BEGIN_STRING
|
||||
INCLUDE $ROOT/tool/spaceanal.tcl
|
||||
END_STRING
|
||||
;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/tcl
|
||||
#
|
||||
# Convert input text into a C string
|
||||
#
|
||||
set in [open [lindex $argv 0] rb]
|
||||
while {![eof $in]} {
|
||||
set line [gets $in]
|
||||
if {[eof $in]} break;
|
||||
set x [string map "\\\\ \\\\\\\\ \\\" \\\\\"" $line]
|
||||
puts "\"$x\\n\""
|
||||
}
|
||||
close $in
|
Reference in New Issue
Block a user