Fix handling of window frames containing negative number of rows. e.g. "ROWS x
[sqlite.git] / tool / mkctimec.tcl
blob499d5a563911e7e1eb9c6b345c26c286b1e0627a
1 #!/usr/bin/tclsh
3 # To build the
5 # const char **azCompileOpt[]
7 # declaration used in src/ctime.c, run this script.
10 # All Boolean compile time options.
12 set boolean_options {
13 SQLITE_32BIT_ROWID
14 SQLITE_4_BYTE_ALIGNED_MALLOC
15 SQLITE_64BIT_STATS
16 SQLITE_ALLOW_COVERING_INDEX_SCAN
17 SQLITE_ALLOW_URI_AUTHORITY
18 SQLITE_BUG_COMPATIBLE_20160819
19 SQLITE_CASE_SENSITIVE_LIKE
20 SQLITE_CHECK_PAGES
21 SQLITE_COVERAGE_TEST
22 SQLITE_DEBUG
23 SQLITE_DEFAULT_AUTOMATIC_INDEX
24 SQLITE_DEFAULT_AUTOVACUUM
25 SQLITE_DEFAULT_CKPTFULLFSYNC
26 SQLITE_DEFAULT_FOREIGN_KEYS
27 SQLITE_DEFAULT_LOCKING_MODE
28 SQLITE_DEFAULT_MEMSTATUS
29 SQLITE_DEFAULT_RECURSIVE_TRIGGERS
30 SQLITE_DEFAULT_SYNCHRONOUS
31 SQLITE_DEFAULT_WAL_SYNCHRONOUS
32 SQLITE_DIRECT_OVERFLOW_READ
33 SQLITE_DISABLE_DIRSYNC
34 SQLITE_DISABLE_FTS3_UNICODE
35 SQLITE_DISABLE_FTS4_DEFERRED
36 SQLITE_DISABLE_INTRINSIC
37 SQLITE_DISABLE_LFS
38 SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
39 SQLITE_DISABLE_SKIPAHEAD_DISTINCT
40 SQLITE_ENABLE_8_3_NAMES
41 SQLITE_ENABLE_API_ARMOR
42 SQLITE_ENABLE_ATOMIC_WRITE
43 SQLITE_ENABLE_CEROD
44 SQLITE_ENABLE_COLUMN_METADATA
45 SQLITE_ENABLE_COLUMN_USED_MASK
46 SQLITE_ENABLE_COSTMULT
47 SQLITE_ENABLE_CURSOR_HINTS
48 SQLITE_ENABLE_DBSTAT_VTAB
49 SQLITE_ENABLE_EXPENSIVE_ASSERT
50 SQLITE_ENABLE_FTS1
51 SQLITE_ENABLE_FTS2
52 SQLITE_ENABLE_FTS3
53 SQLITE_ENABLE_FTS3_PARENTHESIS
54 SQLITE_ENABLE_FTS3_TOKENIZER
55 SQLITE_ENABLE_FTS4
56 SQLITE_ENABLE_FTS5
57 SQLITE_ENABLE_HIDDEN_COLUMNS
58 SQLITE_ENABLE_ICU
59 SQLITE_ENABLE_IOTRACE
60 SQLITE_ENABLE_JSON1
61 SQLITE_ENABLE_LOAD_EXTENSION
62 SQLITE_ENABLE_LOCKING_STYLE
63 SQLITE_ENABLE_MEMORY_MANAGEMENT
64 SQLITE_ENABLE_MEMSYS3
65 SQLITE_ENABLE_MEMSYS5
66 SQLITE_ENABLE_MULTIPLEX
67 SQLITE_ENABLE_NULL_TRIM
68 SQLITE_ENABLE_OVERSIZE_CELL_CHECK
69 SQLITE_ENABLE_PREUPDATE_HOOK
70 SQLITE_ENABLE_RBU
71 SQLITE_ENABLE_RTREE
72 SQLITE_ENABLE_SELECTTRACE
73 SQLITE_ENABLE_SESSION
74 SQLITE_ENABLE_SNAPSHOT
75 SQLITE_ENABLE_SQLLOG
76 SQLITE_ENABLE_STMT_SCANSTATUS
77 SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
78 SQLITE_ENABLE_UNLOCK_NOTIFY
79 SQLITE_ENABLE_UPDATE_DELETE_LIMIT
80 SQLITE_ENABLE_URI_00_ERROR
81 SQLITE_ENABLE_VFSTRACE
82 SQLITE_ENABLE_WHERETRACE
83 SQLITE_ENABLE_ZIPVFS
84 SQLITE_EXPLAIN_ESTIMATED_ROWS
85 SQLITE_EXTRA_IFNULLROW
86 SQLITE_FTS5_ENABLE_TEST_MI
87 SQLITE_FTS5_NO_WITHOUT_ROWID
88 SQLITE_HAS_CODEC
89 SQLITE_HOMEGROWN_RECURSIVE_MUTEX
90 SQLITE_IGNORE_AFP_LOCK_ERRORS
91 SQLITE_IGNORE_FLOCK_LOCK_ERRORS
92 SQLITE_INLINE_MEMCPY
93 SQLITE_INT64_TYPE
94 SQLITE_LIKE_DOESNT_MATCH_BLOBS
95 SQLITE_LOCK_TRACE
96 SQLITE_LOG_CACHE_SPILL
97 SQLITE_MEMDEBUG
98 SQLITE_MIXED_ENDIAN_64BIT_FLOAT
99 SQLITE_MMAP_READWRITE
100 SQLITE_MUTEX_NOOP
101 SQLITE_MUTEX_NREF
102 SQLITE_MUTEX_OMIT
103 SQLITE_MUTEX_PTHREADS
104 SQLITE_MUTEX_W32
105 SQLITE_NEED_ERR_NAME
106 SQLITE_NOINLINE
107 SQLITE_NO_SYNC
108 SQLITE_OMIT_ALTERTABLE
109 SQLITE_OMIT_ANALYZE
110 SQLITE_OMIT_ATTACH
111 SQLITE_OMIT_AUTHORIZATION
112 SQLITE_OMIT_AUTOINCREMENT
113 SQLITE_OMIT_AUTOINIT
114 SQLITE_OMIT_AUTOMATIC_INDEX
115 SQLITE_OMIT_AUTORESET
116 SQLITE_OMIT_AUTOVACUUM
117 SQLITE_OMIT_BETWEEN_OPTIMIZATION
118 SQLITE_OMIT_BLOB_LITERAL
119 SQLITE_OMIT_BTREECOUNT
120 SQLITE_OMIT_CAST
121 SQLITE_OMIT_CHECK
122 SQLITE_OMIT_COMPLETE
123 SQLITE_OMIT_COMPOUND_SELECT
124 SQLITE_OMIT_CONFLICT_CLAUSE
125 SQLITE_OMIT_CTE
126 SQLITE_OMIT_DATETIME_FUNCS
127 SQLITE_OMIT_DECLTYPE
128 SQLITE_OMIT_DEPRECATED
129 SQLITE_OMIT_DISKIO
130 SQLITE_OMIT_EXPLAIN
131 SQLITE_OMIT_FLAG_PRAGMAS
132 SQLITE_OMIT_FLOATING_POINT
133 SQLITE_OMIT_FOREIGN_KEY
134 SQLITE_OMIT_GET_TABLE
135 SQLITE_OMIT_HEX_INTEGER
136 SQLITE_OMIT_INCRBLOB
137 SQLITE_OMIT_INTEGRITY_CHECK
138 SQLITE_OMIT_LIKE_OPTIMIZATION
139 SQLITE_OMIT_LOAD_EXTENSION
140 SQLITE_OMIT_LOCALTIME
141 SQLITE_OMIT_LOOKASIDE
142 SQLITE_OMIT_MEMORYDB
143 SQLITE_OMIT_OR_OPTIMIZATION
144 SQLITE_OMIT_PAGER_PRAGMAS
145 SQLITE_OMIT_PARSER_TRACE
146 SQLITE_OMIT_POPEN
147 SQLITE_OMIT_PRAGMA
148 SQLITE_OMIT_PROGRESS_CALLBACK
149 SQLITE_OMIT_QUICKBALANCE
150 SQLITE_OMIT_REINDEX
151 SQLITE_OMIT_SCHEMA_PRAGMAS
152 SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
153 SQLITE_OMIT_SHARED_CACHE
154 SQLITE_OMIT_SHUTDOWN_DIRECTORIES
155 SQLITE_OMIT_SUBQUERY
156 SQLITE_OMIT_TCL_VARIABLE
157 SQLITE_OMIT_TEMPDB
158 SQLITE_OMIT_TEST_CONTROL
159 SQLITE_OMIT_TRACE
160 SQLITE_OMIT_TRIGGER
161 SQLITE_OMIT_TRUNCATE_OPTIMIZATION
162 SQLITE_OMIT_UTF16
163 SQLITE_OMIT_VACUUM
164 SQLITE_OMIT_VIEW
165 SQLITE_OMIT_VIRTUALTABLE
166 SQLITE_OMIT_WAL
167 SQLITE_OMIT_WSD
168 SQLITE_OMIT_XFER_OPT
169 SQLITE_PCACHE_SEPARATE_HEADER
170 SQLITE_PERFORMANCE_TRACE
171 SQLITE_POWERSAFE_OVERWRITE
172 SQLITE_PREFER_PROXY_LOCKING
173 SQLITE_PROXY_DEBUG
174 SQLITE_REVERSE_UNORDERED_SELECTS
175 SQLITE_RTREE_INT_ONLY
176 SQLITE_SECURE_DELETE
177 SQLITE_SMALL_STACK
178 SQLITE_SOUNDEX
179 SQLITE_SUBSTR_COMPATIBILITY
180 SQLITE_SYSTEM_MALLOC
181 SQLITE_TCL
182 SQLITE_TEST
183 SQLITE_UNLINK_AFTER_CLOSE
184 SQLITE_UNTESTABLE
185 SQLITE_USE_ALLOCA
186 SQLITE_USE_FCNTL_TRACE
187 SQLITE_USER_AUTHENTICATION
188 SQLITE_USE_URI
189 SQLITE_VDBE_COVERAGE
190 SQLITE_WIN32_MALLOC
191 SQLITE_ZERO_MALLOC
194 # All compile time options for which the assigned value is other than boolean.
196 set value_options {
197 SQLITE_BITMASK_TYPE
198 SQLITE_DEFAULT_CACHE_SIZE
199 SQLITE_DEFAULT_FILE_FORMAT
200 SQLITE_DEFAULT_FILE_PERMISSIONS
201 SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT
202 SQLITE_DEFAULT_LOCKING_MODE
203 SQLITE_DEFAULT_LOOKASIDE
204 SQLITE_DEFAULT_MMAP_SIZE
205 SQLITE_DEFAULT_PAGE_SIZE
206 SQLITE_DEFAULT_PCACHE_INITSZ
207 SQLITE_DEFAULT_PROXYDIR_PERMISSIONS
208 SQLITE_DEFAULT_ROWEST
209 SQLITE_DEFAULT_SECTOR_SIZE
210 SQLITE_DEFAULT_SYNCHRONOUS
211 SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
212 SQLITE_DEFAULT_WAL_SYNCHRONOUS
213 SQLITE_DEFAULT_WORKER_THREADS
214 SQLITE_ENABLE_8_3_NAMES
215 SQLITE_ENABLE_LOCKING_STYLE
216 SQLITE_EXTRA_INIT
217 SQLITE_EXTRA_SHUTDOWN
218 SQLITE_FTS3_MAX_EXPR_DEPTH
219 SQLITE_INTEGRITY_CHECK_ERROR_MAX
220 SQLITE_MALLOC_SOFT_LIMIT
221 SQLITE_MAX_ATTACHED
222 SQLITE_MAX_COLUMN
223 SQLITE_MAX_COMPOUND_SELECT
224 SQLITE_MAX_DEFAULT_PAGE_SIZE
225 SQLITE_MAX_EXPR_DEPTH
226 SQLITE_MAX_FUNCTION_ARG
227 SQLITE_MAX_LENGTH
228 SQLITE_MAX_LIKE_PATTERN_LENGTH
229 SQLITE_MAX_MEMORY
230 SQLITE_MAX_MMAP_SIZE
231 SQLITE_MAX_MMAP_SIZE_
232 SQLITE_MAX_PAGE_COUNT
233 SQLITE_MAX_PAGE_SIZE
234 SQLITE_MAX_SCHEMA_RETRY
235 SQLITE_MAX_SQL_LENGTH
236 SQLITE_MAX_TRIGGER_DEPTH
237 SQLITE_MAX_VARIABLE_NUMBER
238 SQLITE_MAX_VDBE_OP
239 SQLITE_MAX_WORKER_THREADS
240 SQLITE_SORTER_PMASZ
241 SQLITE_STAT4_SAMPLES
242 SQLITE_STMTJRNL_SPILL
243 SQLITE_TEMP_STORE
246 # Options that require custom code.
248 set options(ENABLE_STAT3) {
249 #if defined(SQLITE_ENABLE_STAT4)
250 "ENABLE_STAT4",
251 #elif defined(SQLITE_ENABLE_STAT3)
252 "ENABLE_STAT3",
253 #endif
255 set options(COMPILER) {
256 #if defined(__clang__) && defined(__clang_major__)
257 "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "."
258 CTIMEOPT_VAL(__clang_minor__) "."
259 CTIMEOPT_VAL(__clang_patchlevel__),
260 #elif defined(_MSC_VER)
261 "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER),
262 #elif defined(__GNUC__) && defined(__VERSION__)
263 "COMPILER=gcc-" __VERSION__,
264 #endif
266 set options(HAVE_ISNAN) {
267 #if HAVE_ISNAN || SQLITE_HAVE_ISNAN
268 "HAVE_ISNAN",
269 #endif
271 set options(THREADSAFE) {
272 #if defined(SQLITE_THREADSAFE)
273 "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
274 #elif defined(THREADSAFE)
275 "THREADSAFE=" CTIMEOPT_VAL(THREADSAFE),
276 #else
277 "THREADSAFE=1"
278 #endif
281 proc trim_name {in} {
282 set ret $in
283 if {[string range $in 0 6]=="SQLITE_"} {
284 set ret [string range $in 7 end]
286 return $ret
289 foreach b $boolean_options {
290 set name [trim_name $b]
291 set options($name) [subst {
292 #if $b
293 "$name",
294 #endif
298 foreach v $value_options {
299 set name [trim_name $v]
300 set options($name) [subst {
301 #ifdef $v
302 "$name=" CTIMEOPT_VAL($v),
303 #endif
307 foreach o [lsort [array names options]] {
308 puts [string trim $options($o)]