OLD | NEW |
1 #!/usr/bin/tclsh | 1 #!/usr/bin/tclsh |
2 # | 2 # |
3 # This script constructs the "sqlite3.h" header file from the following | 3 # This script constructs the "sqlite3.h" header file from the following |
4 # sources: | 4 # sources: |
5 # | 5 # |
6 # 1) The src/sqlite.h.in source file. This is the template for sqlite3.h. | 6 # 1) The src/sqlite.h.in source file. This is the template for sqlite3.h. |
7 # 2) The VERSION file containing the current SQLite version number. | 7 # 2) The VERSION file containing the current SQLite version number. |
8 # 3) The manifest file from the fossil SCM. This gives use the date. | 8 # 3) The manifest file from the fossil SCM. This gives use the date. |
9 # 4) The manifest.uuid file from the fossil SCM. This gives the SHA1 hash. | 9 # 4) The manifest.uuid file from the fossil SCM. This gives the SHA1 hash. |
10 # | 10 # |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 break | 58 break |
59 } | 59 } |
60 } | 60 } |
61 close $in | 61 close $in |
62 | 62 |
63 # Set up patterns for recognizing API declarations. | 63 # Set up patterns for recognizing API declarations. |
64 # | 64 # |
65 set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+sqlite3_[_a-zA-Z0-9]+(\[|;| =)} | 65 set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+sqlite3_[_a-zA-Z0-9]+(\[|;| =)} |
66 set declpattern {^ *[a-zA-Z][a-zA-Z_0-9 ]+ \**sqlite3_[_a-zA-Z0-9]+\(} | 66 set declpattern {^ *[a-zA-Z][a-zA-Z_0-9 ]+ \**sqlite3_[_a-zA-Z0-9]+\(} |
67 | 67 |
68 # Process the src/sqlite.h.in ext/rtree/sqlite3rtree.h files. | 68 # Force the output to use unix line endings, even on Windows. |
| 69 fconfigure stdout -translation lf |
| 70 |
| 71 set filelist [subst { |
| 72 $TOP/src/sqlite.h.in |
| 73 $TOP/ext/rtree/sqlite3rtree.h |
| 74 }] |
| 75 |
| 76 # Process the source files. |
69 # | 77 # |
70 foreach file [list $TOP/src/sqlite.h.in $TOP/ext/rtree/sqlite3rtree.h] { | 78 foreach file $filelist { |
71 set in [open $file] | 79 set in [open $file] |
72 while {![eof $in]} { | 80 while {![eof $in]} { |
73 | 81 |
74 set line [gets $in] | 82 set line [gets $in] |
75 | 83 |
76 # File sqlite3rtree.h contains a line "#include <sqlite3.h>". Omit this | 84 # File sqlite3rtree.h contains a line "#include <sqlite3.h>". Omit this |
77 # line when copying sqlite3rtree.h into sqlite3.h. | 85 # line when copying sqlite3rtree.h into sqlite3.h. |
78 # | 86 # |
79 if {[string match {*#include*<sqlite3.h>*} $line]} continue | 87 if {[string match {*#include*<sqlite3.h>*} $line]} continue |
80 | 88 |
(...skipping 13 matching lines...) Expand all Loading... |
94 | 102 |
95 if {([regexp $varpattern $line] && ![regexp {^ *typedef} $line]) | 103 if {([regexp $varpattern $line] && ![regexp {^ *typedef} $line]) |
96 || ([regexp $declpattern $line]) | 104 || ([regexp $declpattern $line]) |
97 } { | 105 } { |
98 set line "SQLITE_API $line" | 106 set line "SQLITE_API $line" |
99 } | 107 } |
100 puts $line | 108 puts $line |
101 } | 109 } |
102 close $in | 110 close $in |
103 } | 111 } |
OLD | NEW |