Use the updated Win32 VFS semantics for winOpen from check-in [5d03c738e9] for WinRT...
[sqlite.git] / tool / mkshellc.tcl
blob7ce9dc44311cea3165a5da229d0805d6ff1da75d
1 #!/usr/bin/tclsh
3 # Run this script to generate the "src/shell.c" source file from
4 # constituent parts.
6 set topdir [file dir [file dir [file normal $argv0]]]
7 puts "Overwriting $topdir/src/shell.c with new shell source code..."
8 set out [open $topdir/src/shell.c wb]
9 puts $out {/* DO NOT EDIT!
10 ** This file is automatically generated by the script in the canonical
11 ** SQLite source tree at tool/mkshellc.tcl. That script combines source
12 ** code from various constituent source files of SQLite into this single
13 ** "shell.c" file used to implement the SQLite command-line shell.
15 ** Most of the code found below comes from the "src/shell.c.in" file in
16 ** the canonical SQLite source tree. That main file contains "INCLUDE"
17 ** lines that specify other files in the canonical source tree that are
18 ** inserted to getnerate this complete program source file.
20 ** The code from multiple files is combined into this single "shell.c"
21 ** source file to help make the command-line program easier to compile.
23 ** To modify this program, get a copy of the canonical SQLite source tree,
24 ** edit the src/shell.c.in" and/or some of the other files that are included
25 ** by "src/shell.c.in", then rerun the tool/mkshellc.tcl script.
26 */}
27 set in [open $topdir/src/shell.c.in rb]
28 while {1} {
29 set lx [gets $in]
30 if {[eof $in]} break;
31 if {[regexp {^INCLUDE } $lx]} {
32 set cfile [lindex $lx 1]
33 puts $out "/************************* Begin $cfile ******************/"
34 set in2 [open $topdir/src/$cfile rb]
35 while {![eof $in2]} {
36 set lx [gets $in2]
37 if {[regexp {^#include "sqlite} $lx]} continue
38 set lx [string map [list __declspec(dllexport) {}] $lx]
39 puts $out $lx
41 close $in2
42 puts $out "/************************* End $cfile ********************/"
43 continue
45 puts $out $lx
47 close $in
48 close $out