|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set in [open tsrc/sqlite3.h] |
|
|
set cnt 0 |
|
|
set VERSION ????? |
|
|
while {![eof $in]} { |
|
|
set line [gets $in] |
|
|
if {$line=="" && [eof $in]} break |
|
|
incr cnt |
|
|
regexp {#define\s+SQLITE_VERSION\s+"(.*)"} $line all VERSION |
|
|
} |
|
|
close $in |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set out [open sqlite3internal.h w] |
|
|
set today [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S UTC" -gmt 1] |
|
|
puts $out [subst \ |
|
|
{/****************************************************************************** |
|
|
** This file is an amalgamation of many private header files from SQLite |
|
|
** version $VERSION. |
|
|
*/}] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach hdr { |
|
|
btree.h |
|
|
btreeInt.h |
|
|
hash.h |
|
|
hwtime.h |
|
|
keywordhash.h |
|
|
msvc.h |
|
|
opcodes.h |
|
|
os_common.h |
|
|
os_setup.h |
|
|
os_win.h |
|
|
os.h |
|
|
pager.h |
|
|
parse.h |
|
|
sqlite3ext.h |
|
|
sqlite3.h |
|
|
sqliteInt.h |
|
|
sqliteLimit.h |
|
|
vdbe.h |
|
|
vdbeInt.h |
|
|
} { |
|
|
set available_hdr($hdr) 1 |
|
|
} |
|
|
|
|
|
|
|
|
set s78 \ |
|
|
{*****************************************************************************} |
|
|
|
|
|
|
|
|
|
|
|
proc section_comment {text} { |
|
|
global out s78 |
|
|
set n [string length $text] |
|
|
set nstar [expr {60 - $n}] |
|
|
set stars [string range $s78 0 $nstar] |
|
|
puts $out "/************** $text $stars/" |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc copy_file {filename} { |
|
|
global seen_hdr available_hdr out |
|
|
set tail [file tail $filename] |
|
|
section_comment "Begin file $tail" |
|
|
set in [open $filename r] |
|
|
while {![eof $in]} { |
|
|
set line [gets $in] |
|
|
if {[regexp {^#\s*include\s+["<]([^">]+)[">]} $line all hdr]} { |
|
|
if {[info exists available_hdr($hdr)]} { |
|
|
if {$available_hdr($hdr)} { |
|
|
section_comment "Include $hdr in the middle of $tail" |
|
|
copy_file tsrc/$hdr |
|
|
section_comment "Continuing where we left off in $tail" |
|
|
} |
|
|
} elseif {![info exists seen_hdr($hdr)]} { |
|
|
set seen_hdr($hdr) 1 |
|
|
puts $out $line |
|
|
} |
|
|
} elseif {[regexp {^#ifdef __cplusplus} $line]} { |
|
|
puts $out "#if 0" |
|
|
} elseif {[regexp {^#line} $line]} { |
|
|
# Skip #line directives. |
|
|
} else { |
|
|
puts $out $line |
|
|
} |
|
|
} |
|
|
close $in |
|
|
section_comment "End of $tail" |
|
|
} |
|
|
|
|
|
|
|
|
# Process the source files. Process files containing commonly |
|
|
# used subroutines first in order to help the compiler find |
|
|
# inlining opportunities. |
|
|
# |
|
|
foreach file { |
|
|
sqliteInt.h |
|
|
sqlite3.h |
|
|
btree.h |
|
|
hash.h |
|
|
os.h |
|
|
pager.h |
|
|
parse.h |
|
|
sqlite3ext.h |
|
|
vdbe.h |
|
|
} { |
|
|
if {$available_hdr($file)} { |
|
|
copy_file tsrc/$file |
|
|
} |
|
|
} |
|
|
|
|
|
close $out |
|
|
|