2013-09-13 20:36:46 +04:00
|
|
|
#!/usr/bin/tclsh
|
|
|
|
#
|
|
|
|
# Run this script to generate the pragma name lookup table C code.
|
|
|
|
#
|
|
|
|
# To add new pragmas, first add the name and other relevant attributes
|
|
|
|
# of the pragma to the "pragma_def" object below. Then run this script
|
2015-02-03 00:34:54 +03:00
|
|
|
# to generate the ../src/pragma.h header file that contains macros and
|
|
|
|
# the lookup table needed for pragma name lookup in the pragma.c module.
|
2013-09-13 20:36:46 +04:00
|
|
|
# Then add the extra "case PragTyp_XXXXX:" and subsequent code for the
|
2015-02-03 00:34:54 +03:00
|
|
|
# new pragma in ../src/pragma.c.
|
2013-09-13 20:36:46 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
set pragma_def {
|
|
|
|
NAME: full_column_names
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_FullColNames
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: short_column_names
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_ShortColNames
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: count_changes
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_CountRows
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: empty_result_callbacks
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_NullCallback
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: legacy_file_format
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_LegacyFileFmt
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: fullfsync
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_FullFSync
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: checkpoint_fullfsync
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_CkptFullFSync
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: cache_spill
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_CacheSpill
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: reverse_unordered_selects
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_ReverseOrder
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: query_only
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_QueryOnly
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: automatic_index
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_AutoIndex
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_AUTOMATIC_INDEX)
|
|
|
|
|
|
|
|
NAME: sql_trace
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_SqlTrace
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: defined(SQLITE_DEBUG)
|
|
|
|
|
|
|
|
NAME: vdbe_listing
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_VdbeListing
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: defined(SQLITE_DEBUG)
|
|
|
|
|
|
|
|
NAME: vdbe_trace
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_VdbeTrace
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: defined(SQLITE_DEBUG)
|
|
|
|
|
|
|
|
NAME: vdbe_addoptrace
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_VdbeAddopTrace
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: defined(SQLITE_DEBUG)
|
|
|
|
|
|
|
|
NAME: vdbe_debug
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: defined(SQLITE_DEBUG)
|
|
|
|
|
2013-11-13 21:58:23 +04:00
|
|
|
NAME: vdbe_eqp
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_VdbeEQP
|
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
|
|
|
IF: defined(SQLITE_DEBUG)
|
|
|
|
|
2013-09-13 20:36:46 +04:00
|
|
|
NAME: ignore_check_constraints
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_IgnoreChecks
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_CHECK)
|
|
|
|
|
|
|
|
NAME: writable_schema
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_WriteSchema|SQLITE_RecoveryMode
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: read_uncommitted
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_ReadUncommitted
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: recursive_triggers
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_RecTriggers
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
NAME: foreign_keys
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_ForeignKeys
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
|
|
|
|
|
|
|
|
NAME: defer_foreign_keys
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_DeferFKs
|
2013-10-22 03:17:23 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
|
|
|
|
|
2015-05-27 06:46:18 +03:00
|
|
|
NAME: cell_size_check
|
|
|
|
TYPE: FLAG
|
|
|
|
ARG: SQLITE_CellSizeCk
|
|
|
|
|
2013-09-13 20:36:46 +04:00
|
|
|
NAME: default_cache_size
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
|
|
|
|
|
|
|
|
NAME: page_size
|
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: secure_delete
|
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: page_count
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: max_page_count
|
|
|
|
TYPE: PAGE_COUNT
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: locking_mode
|
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: journal_mode
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: journal_size_limit
|
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: cache_size
|
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: mmap_size
|
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: auto_vacuum
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_AUTOVACUUM)
|
|
|
|
|
|
|
|
NAME: incremental_vacuum
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_AUTOVACUUM)
|
|
|
|
|
|
|
|
NAME: temp_store
|
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: temp_store_directory
|
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: data_store_directory
|
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN
|
|
|
|
|
|
|
|
NAME: lock_proxy_file
|
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE
|
|
|
|
|
|
|
|
NAME: synchronous
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: table_info
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
|
|
2013-10-13 00:22:00 +04:00
|
|
|
NAME: stats
|
|
|
|
FLAG: NeedSchema
|
|
|
|
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
|
|
2013-09-13 20:36:46 +04:00
|
|
|
NAME: index_info
|
2015-01-31 05:00:01 +03:00
|
|
|
TYPE: INDEX_INFO
|
|
|
|
ARG: 0
|
|
|
|
FLAG: NeedSchema
|
|
|
|
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: index_xinfo
|
|
|
|
TYPE: INDEX_INFO
|
|
|
|
ARG: 1
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: index_list
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: database_list
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: collation_list
|
|
|
|
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: foreign_key_list
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FOREIGN_KEY)
|
|
|
|
|
|
|
|
NAME: foreign_key_check
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
|
|
|
|
|
|
|
|
NAME: parser_trace
|
|
|
|
IF: defined(SQLITE_DEBUG)
|
|
|
|
|
|
|
|
NAME: case_sensitive_like
|
|
|
|
|
|
|
|
NAME: integrity_check
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_INTEGRITY_CHECK)
|
|
|
|
|
|
|
|
NAME: quick_check
|
|
|
|
TYPE: INTEGRITY_CHECK
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_INTEGRITY_CHECK)
|
|
|
|
|
|
|
|
NAME: encoding
|
|
|
|
IF: !defined(SQLITE_OMIT_UTF16)
|
|
|
|
|
|
|
|
NAME: schema_version
|
|
|
|
TYPE: HEADER_VALUE
|
2014-12-19 21:49:55 +03:00
|
|
|
ARG: BTREE_SCHEMA_VERSION
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: user_version
|
|
|
|
TYPE: HEADER_VALUE
|
2014-12-19 21:49:55 +03:00
|
|
|
ARG: BTREE_USER_VERSION
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
|
|
|
|
|
2014-12-19 22:28:02 +03:00
|
|
|
NAME: data_version
|
|
|
|
TYPE: HEADER_VALUE
|
|
|
|
ARG: BTREE_DATA_VERSION
|
|
|
|
FLAG: ReadOnly
|
|
|
|
IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
|
|
|
|
|
2013-09-13 20:36:46 +04:00
|
|
|
NAME: freelist_count
|
|
|
|
TYPE: HEADER_VALUE
|
2014-12-19 21:49:55 +03:00
|
|
|
ARG: BTREE_FREE_PAGE_COUNT
|
|
|
|
FLAG: ReadOnly
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: application_id
|
|
|
|
TYPE: HEADER_VALUE
|
2014-12-19 21:49:55 +03:00
|
|
|
ARG: BTREE_APPLICATION_ID
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
|
|
|
|
|
|
|
|
NAME: compile_options
|
|
|
|
IF: !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
|
|
|
|
|
|
|
|
NAME: wal_checkpoint
|
2013-10-03 18:08:07 +04:00
|
|
|
FLAG: NeedSchema
|
2013-09-13 20:36:46 +04:00
|
|
|
IF: !defined(SQLITE_OMIT_WAL)
|
|
|
|
|
|
|
|
NAME: wal_autocheckpoint
|
|
|
|
IF: !defined(SQLITE_OMIT_WAL)
|
|
|
|
|
|
|
|
NAME: shrink_memory
|
|
|
|
|
|
|
|
NAME: busy_timeout
|
|
|
|
|
|
|
|
NAME: lock_status
|
|
|
|
IF: defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
|
|
|
|
|
|
|
|
NAME: key
|
|
|
|
IF: defined(SQLITE_HAS_CODEC)
|
|
|
|
|
|
|
|
NAME: rekey
|
|
|
|
IF: defined(SQLITE_HAS_CODEC)
|
|
|
|
|
|
|
|
NAME: hexkey
|
|
|
|
IF: defined(SQLITE_HAS_CODEC)
|
|
|
|
|
2013-10-07 04:36:01 +04:00
|
|
|
NAME: hexrekey
|
|
|
|
TYPE: HEXKEY
|
|
|
|
IF: defined(SQLITE_HAS_CODEC)
|
|
|
|
|
2013-09-13 20:36:46 +04:00
|
|
|
NAME: activate_extensions
|
|
|
|
IF: defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD)
|
2013-09-14 01:01:56 +04:00
|
|
|
|
|
|
|
NAME: soft_heap_limit
|
2014-08-25 19:13:22 +04:00
|
|
|
|
|
|
|
NAME: threads
|
2013-09-13 20:36:46 +04:00
|
|
|
}
|
2015-02-03 00:34:54 +03:00
|
|
|
|
|
|
|
# Open the output file
|
|
|
|
#
|
|
|
|
set destfile "[file dir [file dir [file normal $argv0]]]/src/pragma.h"
|
|
|
|
puts "Overwriting $destfile with new pragma table..."
|
|
|
|
set fd [open $destfile wb]
|
|
|
|
puts $fd {/* DO NOT EDIT!
|
|
|
|
** This file is automatically generated by the script at
|
|
|
|
** ../tool/mkpragmatab.tcl. To update the set of pragmas, edit
|
|
|
|
** that script and rerun it.
|
|
|
|
*/}
|
|
|
|
|
|
|
|
# Parse the PRAGMA table above.
|
|
|
|
#
|
2013-09-13 20:36:46 +04:00
|
|
|
set name {}
|
|
|
|
set type {}
|
|
|
|
set if {}
|
2013-10-03 18:08:07 +04:00
|
|
|
set flags {}
|
2013-09-13 20:36:46 +04:00
|
|
|
set arg 0
|
|
|
|
proc record_one {} {
|
2013-10-03 18:08:07 +04:00
|
|
|
global name type if arg allbyname typebyif flags
|
2013-09-13 20:36:46 +04:00
|
|
|
if {$name==""} return
|
2013-10-03 18:08:07 +04:00
|
|
|
set allbyname($name) [list $type $arg $if $flags]
|
2013-09-13 20:36:46 +04:00
|
|
|
set name {}
|
|
|
|
set type {}
|
|
|
|
set if {}
|
2013-10-03 18:08:07 +04:00
|
|
|
set flags {}
|
2013-09-13 20:36:46 +04:00
|
|
|
set arg 0
|
|
|
|
}
|
|
|
|
foreach line [split $pragma_def \n] {
|
|
|
|
set line [string trim $line]
|
|
|
|
if {$line==""} continue
|
|
|
|
foreach {id val} [split $line :] break
|
|
|
|
set val [string trim $val]
|
|
|
|
if {$id=="NAME"} {
|
|
|
|
record_one
|
|
|
|
set name $val
|
|
|
|
set type [string toupper $val]
|
|
|
|
} elseif {$id=="TYPE"} {
|
|
|
|
set type $val
|
|
|
|
} elseif {$id=="ARG"} {
|
|
|
|
set arg $val
|
|
|
|
} elseif {$id=="IF"} {
|
2013-10-22 03:17:23 +04:00
|
|
|
lappend if $val
|
2013-10-03 18:08:07 +04:00
|
|
|
} elseif {$id=="FLAG"} {
|
|
|
|
foreach term [split $val] {
|
|
|
|
lappend flags $term
|
|
|
|
set allflags($term) 1
|
|
|
|
}
|
2013-09-13 20:36:46 +04:00
|
|
|
} else {
|
|
|
|
error "bad pragma_def line: $line"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
record_one
|
|
|
|
set allnames [lsort [array names allbyname]]
|
|
|
|
|
|
|
|
# Generate #defines for all pragma type names. Group the pragmas that are
|
|
|
|
# omit in default builds (defined(SQLITE_DEBUG) and defined(SQLITE_HAS_CODEC))
|
|
|
|
# at the end.
|
|
|
|
#
|
|
|
|
set pnum 0
|
|
|
|
foreach name $allnames {
|
|
|
|
set type [lindex $allbyname($name) 0]
|
|
|
|
if {[info exists seentype($type)]} continue
|
|
|
|
set if [lindex $allbyname($name) 2]
|
|
|
|
if {[regexp SQLITE_DEBUG $if] || [regexp SQLITE_HAS_CODEC $if]} continue
|
|
|
|
set seentype($type) 1
|
2015-02-03 00:34:54 +03:00
|
|
|
puts $fd [format {#define %-35s %4d} PragTyp_$type $pnum]
|
2013-09-13 20:36:46 +04:00
|
|
|
incr pnum
|
|
|
|
}
|
|
|
|
foreach name $allnames {
|
|
|
|
set type [lindex $allbyname($name) 0]
|
|
|
|
if {[info exists seentype($type)]} continue
|
|
|
|
set if [lindex $allbyname($name) 2]
|
|
|
|
if {[regexp SQLITE_DEBUG $if]} continue
|
|
|
|
set seentype($type) 1
|
2015-02-03 00:34:54 +03:00
|
|
|
puts $fd [format {#define %-35s %4d} PragTyp_$type $pnum]
|
2013-09-13 20:36:46 +04:00
|
|
|
incr pnum
|
|
|
|
}
|
|
|
|
foreach name $allnames {
|
|
|
|
set type [lindex $allbyname($name) 0]
|
|
|
|
if {[info exists seentype($type)]} continue
|
|
|
|
set seentype($type) 1
|
2015-02-03 00:34:54 +03:00
|
|
|
puts $fd [format {#define %-35s %4d} PragTyp_$type $pnum]
|
2013-09-13 20:36:46 +04:00
|
|
|
incr pnum
|
|
|
|
}
|
|
|
|
|
2013-10-03 18:08:07 +04:00
|
|
|
# Generate #defines for flags
|
|
|
|
#
|
|
|
|
set fv 1
|
|
|
|
foreach f [lsort [array names allflags]] {
|
2015-02-03 00:34:54 +03:00
|
|
|
puts $fd [format {#define PragFlag_%-20s 0x%02x} $f $fv]
|
2013-10-03 18:08:07 +04:00
|
|
|
set fv [expr {$fv*2}]
|
|
|
|
}
|
|
|
|
|
2013-09-13 20:36:46 +04:00
|
|
|
# Generate the lookup table
|
|
|
|
#
|
2015-02-03 00:34:54 +03:00
|
|
|
puts $fd "static const struct sPragmaNames \173"
|
|
|
|
puts $fd " const char *const zName; /* Name of pragma */"
|
|
|
|
puts $fd " u8 ePragTyp; /* PragTyp_XXX value */"
|
|
|
|
puts $fd " u8 mPragFlag; /* Zero or more PragFlag_XXX values */"
|
|
|
|
puts $fd " u32 iArg; /* Extra argument */"
|
|
|
|
puts $fd "\175 aPragmaNames\[\] = \173"
|
2013-09-13 20:36:46 +04:00
|
|
|
|
|
|
|
set current_if {}
|
|
|
|
set spacer [format { %26s } {}]
|
|
|
|
foreach name $allnames {
|
2013-10-03 18:08:07 +04:00
|
|
|
foreach {type arg if flag} $allbyname($name) break
|
2013-09-13 20:36:46 +04:00
|
|
|
if {$if!=$current_if} {
|
2013-10-22 03:17:23 +04:00
|
|
|
if {$current_if!=""} {
|
|
|
|
foreach this_if $current_if {
|
2015-02-03 00:34:54 +03:00
|
|
|
puts $fd "#endif"
|
2013-10-22 03:17:23 +04:00
|
|
|
}
|
|
|
|
}
|
2013-09-13 20:36:46 +04:00
|
|
|
set current_if $if
|
2013-10-22 03:17:23 +04:00
|
|
|
if {$current_if!=""} {
|
|
|
|
foreach this_if $current_if {
|
2015-02-03 00:34:54 +03:00
|
|
|
puts $fd "#if $this_if"
|
2013-10-22 03:17:23 +04:00
|
|
|
}
|
|
|
|
}
|
2013-09-13 20:36:46 +04:00
|
|
|
}
|
|
|
|
set typex [format PragTyp_%-23s $type,]
|
2013-10-03 18:08:07 +04:00
|
|
|
if {$flag==""} {
|
|
|
|
set flagx "0"
|
2013-09-13 20:36:46 +04:00
|
|
|
} else {
|
2013-10-03 18:08:07 +04:00
|
|
|
set flagx PragFlag_[join $flag {|PragFlag_}]
|
2013-09-13 20:36:46 +04:00
|
|
|
}
|
2015-02-03 00:34:54 +03:00
|
|
|
puts $fd " \173 /* zName: */ \"$name\","
|
|
|
|
puts $fd " /* ePragTyp: */ PragTyp_$type,"
|
|
|
|
puts $fd " /* ePragFlag: */ $flagx,"
|
|
|
|
puts $fd " /* iArg: */ $arg \175,"
|
2013-09-13 20:36:46 +04:00
|
|
|
}
|
2013-10-22 03:17:23 +04:00
|
|
|
if {$current_if!=""} {
|
|
|
|
foreach this_if $current_if {
|
2015-02-03 00:34:54 +03:00
|
|
|
puts $fd "#endif"
|
2013-10-22 03:17:23 +04:00
|
|
|
}
|
|
|
|
}
|
2015-02-03 00:34:54 +03:00
|
|
|
puts $fd "\175;"
|
2013-09-13 20:56:17 +04:00
|
|
|
|
|
|
|
# count the number of pragmas, for information purposes
|
|
|
|
#
|
|
|
|
set allcnt 0
|
|
|
|
set dfltcnt 0
|
|
|
|
foreach name $allnames {
|
|
|
|
incr allcnt
|
|
|
|
set if [lindex $allbyname($name) 2]
|
|
|
|
if {[regexp {^defined} $if] || [regexp {[^!]defined} $if]} continue
|
|
|
|
incr dfltcnt
|
|
|
|
}
|
2015-02-03 00:34:54 +03:00
|
|
|
puts $fd "/* Number of pragmas: $dfltcnt on by default, $allcnt total. */"
|