OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/tclsh |
| 2 # |
| 3 # Run this script to generate the pragma name lookup table C code. |
| 4 # |
| 5 # To add new pragmas, first add the name and other relevant attributes |
| 6 # of the pragma to the "pragma_def" object below. Then run this script |
| 7 # to generate the ../src/pragma.h header file that contains macros and |
| 8 # the lookup table needed for pragma name lookup in the pragma.c module. |
| 9 # Then add the extra "case PragTyp_XXXXX:" and subsequent code for the |
| 10 # new pragma in ../src/pragma.c. |
| 11 # |
| 12 |
| 13 # Flag meanings: |
| 14 set flagMeaning(NeedSchema) {Force schema load before running} |
| 15 set flagMeaning(ReadOnly) {Read-only HEADER_VALUE} |
| 16 set flagMeaning(Result0) {Acts as query when no argument} |
| 17 set flagMeaning(Result1) {Acts as query when has one argument} |
| 18 set flagMeaning(SchemaReq) {Schema required - "main" is default} |
| 19 set flagMeaning(SchemaOpt) {Schema restricts name search if present} |
| 20 set flagMeaning(NoColumns) {OP_ResultRow called with zero columns} |
| 21 set flagMeaning(NoColumns1) {zero columns if RHS argument is present} |
| 22 |
| 23 set pragma_def { |
| 24 NAME: full_column_names |
| 25 TYPE: FLAG |
| 26 ARG: SQLITE_FullColNames |
| 27 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 28 |
| 29 NAME: short_column_names |
| 30 TYPE: FLAG |
| 31 ARG: SQLITE_ShortColNames |
| 32 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 33 |
| 34 NAME: count_changes |
| 35 TYPE: FLAG |
| 36 ARG: SQLITE_CountRows |
| 37 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 38 |
| 39 NAME: empty_result_callbacks |
| 40 TYPE: FLAG |
| 41 ARG: SQLITE_NullCallback |
| 42 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 43 |
| 44 NAME: legacy_file_format |
| 45 TYPE: FLAG |
| 46 ARG: SQLITE_LegacyFileFmt |
| 47 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 48 |
| 49 NAME: fullfsync |
| 50 TYPE: FLAG |
| 51 ARG: SQLITE_FullFSync |
| 52 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 53 |
| 54 NAME: checkpoint_fullfsync |
| 55 TYPE: FLAG |
| 56 ARG: SQLITE_CkptFullFSync |
| 57 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 58 |
| 59 NAME: cache_spill |
| 60 FLAG: Result0 SchemaReq NoColumns1 |
| 61 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 62 |
| 63 NAME: reverse_unordered_selects |
| 64 TYPE: FLAG |
| 65 ARG: SQLITE_ReverseOrder |
| 66 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 67 |
| 68 NAME: query_only |
| 69 TYPE: FLAG |
| 70 ARG: SQLITE_QueryOnly |
| 71 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 72 |
| 73 NAME: automatic_index |
| 74 TYPE: FLAG |
| 75 ARG: SQLITE_AutoIndex |
| 76 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 77 IF: !defined(SQLITE_OMIT_AUTOMATIC_INDEX) |
| 78 |
| 79 NAME: sql_trace |
| 80 TYPE: FLAG |
| 81 ARG: SQLITE_SqlTrace |
| 82 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 83 IF: defined(SQLITE_DEBUG) |
| 84 |
| 85 NAME: vdbe_listing |
| 86 TYPE: FLAG |
| 87 ARG: SQLITE_VdbeListing |
| 88 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 89 IF: defined(SQLITE_DEBUG) |
| 90 |
| 91 NAME: vdbe_trace |
| 92 TYPE: FLAG |
| 93 ARG: SQLITE_VdbeTrace |
| 94 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 95 IF: defined(SQLITE_DEBUG) |
| 96 |
| 97 NAME: vdbe_addoptrace |
| 98 TYPE: FLAG |
| 99 ARG: SQLITE_VdbeAddopTrace |
| 100 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 101 IF: defined(SQLITE_DEBUG) |
| 102 |
| 103 NAME: vdbe_debug |
| 104 TYPE: FLAG |
| 105 ARG: SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace |
| 106 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 107 IF: defined(SQLITE_DEBUG) |
| 108 |
| 109 NAME: vdbe_eqp |
| 110 TYPE: FLAG |
| 111 ARG: SQLITE_VdbeEQP |
| 112 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 113 IF: defined(SQLITE_DEBUG) |
| 114 |
| 115 NAME: ignore_check_constraints |
| 116 TYPE: FLAG |
| 117 ARG: SQLITE_IgnoreChecks |
| 118 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 119 IF: !defined(SQLITE_OMIT_CHECK) |
| 120 |
| 121 NAME: writable_schema |
| 122 TYPE: FLAG |
| 123 ARG: SQLITE_WriteSchema|SQLITE_RecoveryMode |
| 124 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 125 |
| 126 NAME: read_uncommitted |
| 127 TYPE: FLAG |
| 128 ARG: SQLITE_ReadUncommitted |
| 129 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 130 |
| 131 NAME: recursive_triggers |
| 132 TYPE: FLAG |
| 133 ARG: SQLITE_RecTriggers |
| 134 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 135 |
| 136 NAME: foreign_keys |
| 137 TYPE: FLAG |
| 138 ARG: SQLITE_ForeignKeys |
| 139 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 140 IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) |
| 141 |
| 142 NAME: defer_foreign_keys |
| 143 TYPE: FLAG |
| 144 ARG: SQLITE_DeferFKs |
| 145 IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 146 IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) |
| 147 |
| 148 NAME: cell_size_check |
| 149 TYPE: FLAG |
| 150 ARG: SQLITE_CellSizeCk |
| 151 |
| 152 NAME: default_cache_size |
| 153 FLAG: NeedSchema Result0 SchemaReq NoColumns1 |
| 154 COLS: cache_size |
| 155 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED) |
| 156 |
| 157 NAME: page_size |
| 158 FLAG: Result0 SchemaReq NoColumns1 |
| 159 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 160 |
| 161 NAME: secure_delete |
| 162 FLAG: Result0 |
| 163 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 164 |
| 165 NAME: page_count |
| 166 FLAG: NeedSchema Result0 SchemaReq |
| 167 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 168 |
| 169 NAME: max_page_count |
| 170 TYPE: PAGE_COUNT |
| 171 FLAG: NeedSchema Result0 SchemaReq |
| 172 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 173 |
| 174 NAME: locking_mode |
| 175 FLAG: Result0 SchemaReq |
| 176 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 177 |
| 178 NAME: journal_mode |
| 179 FLAG: NeedSchema Result0 SchemaReq |
| 180 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 181 |
| 182 NAME: journal_size_limit |
| 183 FLAG: Result0 SchemaReq |
| 184 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 185 |
| 186 NAME: cache_size |
| 187 FLAG: NeedSchema Result0 SchemaReq NoColumns1 |
| 188 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 189 |
| 190 NAME: mmap_size |
| 191 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 192 |
| 193 NAME: auto_vacuum |
| 194 FLAG: NeedSchema Result0 SchemaReq NoColumns1 |
| 195 IF: !defined(SQLITE_OMIT_AUTOVACUUM) |
| 196 |
| 197 NAME: incremental_vacuum |
| 198 FLAG: NeedSchema NoColumns |
| 199 IF: !defined(SQLITE_OMIT_AUTOVACUUM) |
| 200 |
| 201 NAME: temp_store |
| 202 FLAG: Result0 NoColumns1 |
| 203 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 204 |
| 205 NAME: temp_store_directory |
| 206 FLAG: NoColumns1 |
| 207 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 208 |
| 209 NAME: data_store_directory |
| 210 FLAG: NoColumns1 |
| 211 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN |
| 212 |
| 213 NAME: lock_proxy_file |
| 214 FLAG: NoColumns1 |
| 215 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE |
| 216 |
| 217 NAME: synchronous |
| 218 FLAG: NeedSchema Result0 SchemaReq NoColumns1 |
| 219 IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 220 |
| 221 NAME: table_info |
| 222 FLAG: NeedSchema Result1 SchemaOpt |
| 223 COLS: cid name type notnull dflt_value pk |
| 224 IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) |
| 225 |
| 226 NAME: stats |
| 227 FLAG: NeedSchema Result0 SchemaReq |
| 228 COLS: table index width height |
| 229 IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) |
| 230 |
| 231 NAME: index_info |
| 232 TYPE: INDEX_INFO |
| 233 ARG: 0 |
| 234 FLAG: NeedSchema Result1 SchemaOpt |
| 235 COLS: seqno cid name |
| 236 IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) |
| 237 |
| 238 NAME: index_xinfo |
| 239 TYPE: INDEX_INFO |
| 240 ARG: 1 |
| 241 FLAG: NeedSchema Result1 SchemaOpt |
| 242 COLS: seqno cid name desc coll key |
| 243 IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) |
| 244 |
| 245 NAME: index_list |
| 246 FLAG: NeedSchema Result1 SchemaOpt |
| 247 COLS: seq name unique origin partial |
| 248 IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) |
| 249 |
| 250 NAME: database_list |
| 251 FLAG: NeedSchema Result0 |
| 252 COLS: seq name file |
| 253 IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) |
| 254 |
| 255 NAME: collation_list |
| 256 FLAG: Result0 |
| 257 COLS: seq name |
| 258 IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) |
| 259 |
| 260 NAME: foreign_key_list |
| 261 FLAG: NeedSchema Result1 SchemaOpt |
| 262 COLS: id seq table from to on_update on_delete match |
| 263 IF: !defined(SQLITE_OMIT_FOREIGN_KEY) |
| 264 |
| 265 NAME: foreign_key_check |
| 266 FLAG: NeedSchema |
| 267 COLS: table rowid parent fkid |
| 268 IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) |
| 269 |
| 270 NAME: parser_trace |
| 271 IF: defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE) |
| 272 |
| 273 NAME: case_sensitive_like |
| 274 FLAG: NoColumns |
| 275 |
| 276 NAME: integrity_check |
| 277 FLAG: NeedSchema |
| 278 IF: !defined(SQLITE_OMIT_INTEGRITY_CHECK) |
| 279 |
| 280 NAME: quick_check |
| 281 TYPE: INTEGRITY_CHECK |
| 282 FLAG: NeedSchema |
| 283 IF: !defined(SQLITE_OMIT_INTEGRITY_CHECK) |
| 284 |
| 285 NAME: encoding |
| 286 FLAG: Result0 NoColumns1 |
| 287 IF: !defined(SQLITE_OMIT_UTF16) |
| 288 |
| 289 NAME: schema_version |
| 290 TYPE: HEADER_VALUE |
| 291 ARG: BTREE_SCHEMA_VERSION |
| 292 FLAG: NoColumns1 Result0 |
| 293 IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) |
| 294 |
| 295 NAME: user_version |
| 296 TYPE: HEADER_VALUE |
| 297 ARG: BTREE_USER_VERSION |
| 298 FLAG: NoColumns1 Result0 |
| 299 IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) |
| 300 |
| 301 NAME: data_version |
| 302 TYPE: HEADER_VALUE |
| 303 ARG: BTREE_DATA_VERSION |
| 304 FLAG: ReadOnly Result0 |
| 305 IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) |
| 306 |
| 307 NAME: freelist_count |
| 308 TYPE: HEADER_VALUE |
| 309 ARG: BTREE_FREE_PAGE_COUNT |
| 310 FLAG: ReadOnly Result0 |
| 311 IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) |
| 312 |
| 313 NAME: application_id |
| 314 TYPE: HEADER_VALUE |
| 315 ARG: BTREE_APPLICATION_ID |
| 316 FLAG: NoColumns1 Result0 |
| 317 IF: !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) |
| 318 |
| 319 NAME: compile_options |
| 320 FLAG: Result0 |
| 321 IF: !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS) |
| 322 |
| 323 NAME: wal_checkpoint |
| 324 FLAG: NeedSchema |
| 325 COLS: busy log checkpointed |
| 326 IF: !defined(SQLITE_OMIT_WAL) |
| 327 |
| 328 NAME: wal_autocheckpoint |
| 329 IF: !defined(SQLITE_OMIT_WAL) |
| 330 |
| 331 NAME: shrink_memory |
| 332 FLAG: NoColumns |
| 333 |
| 334 NAME: busy_timeout |
| 335 FLAG: Result0 |
| 336 COLS: timeout |
| 337 |
| 338 NAME: lock_status |
| 339 FLAG: Result0 |
| 340 COLS: database status |
| 341 IF: defined(SQLITE_DEBUG) || defined(SQLITE_TEST) |
| 342 |
| 343 NAME: key |
| 344 IF: defined(SQLITE_HAS_CODEC) |
| 345 |
| 346 NAME: rekey |
| 347 IF: defined(SQLITE_HAS_CODEC) |
| 348 |
| 349 NAME: hexkey |
| 350 IF: defined(SQLITE_HAS_CODEC) |
| 351 |
| 352 NAME: hexrekey |
| 353 TYPE: HEXKEY |
| 354 IF: defined(SQLITE_HAS_CODEC) |
| 355 |
| 356 NAME: activate_extensions |
| 357 IF: defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD) |
| 358 |
| 359 NAME: soft_heap_limit |
| 360 FLAG: Result0 |
| 361 |
| 362 NAME: threads |
| 363 FLAG: Result0 |
| 364 } |
| 365 |
| 366 # Open the output file |
| 367 # |
| 368 set destfile "[file dir [file dir [file normal $argv0]]]/src/pragma.h" |
| 369 puts "Overwriting $destfile with new pragma table..." |
| 370 set fd [open $destfile wb] |
| 371 puts $fd {/* DO NOT EDIT! |
| 372 ** This file is automatically generated by the script at |
| 373 ** ../tool/mkpragmatab.tcl. To update the set of pragmas, edit |
| 374 ** that script and rerun it. |
| 375 */} |
| 376 |
| 377 # Parse the PRAGMA table above. |
| 378 # |
| 379 set name {} |
| 380 set type {} |
| 381 set if {} |
| 382 set flags {} |
| 383 set cols {} |
| 384 set cols_list {} |
| 385 set arg 0 |
| 386 proc record_one {} { |
| 387 global name type if arg allbyname typebyif flags cols allcols |
| 388 global cols_list colUsedBy |
| 389 if {$name==""} return |
| 390 if {$cols!=""} { |
| 391 if {![info exists allcols($cols)]} { |
| 392 lappend cols_list $cols |
| 393 set allcols($cols) [llength $cols_list] |
| 394 } |
| 395 set cx $allcols($cols) |
| 396 lappend colUsedBy($cols) $name |
| 397 } else { |
| 398 set cx 0 |
| 399 } |
| 400 set allbyname($name) [list $type $arg $if $flags $cx] |
| 401 set name {} |
| 402 set type {} |
| 403 set if {} |
| 404 set flags {} |
| 405 set cols {} |
| 406 set arg 0 |
| 407 } |
| 408 foreach line [split $pragma_def \n] { |
| 409 set line [string trim $line] |
| 410 if {$line==""} continue |
| 411 foreach {id val} [split $line :] break |
| 412 set val [string trim $val] |
| 413 if {$id=="NAME"} { |
| 414 record_one |
| 415 set name $val |
| 416 set type [string toupper $val] |
| 417 } elseif {$id=="TYPE"} { |
| 418 set type $val |
| 419 if {$type=="FLAG"} { |
| 420 lappend flags Result0 NoColumns1 |
| 421 } |
| 422 } elseif {$id=="ARG"} { |
| 423 set arg $val |
| 424 } elseif {$id=="COLS"} { |
| 425 set cols $val |
| 426 } elseif {$id=="IF"} { |
| 427 lappend if $val |
| 428 } elseif {$id=="FLAG"} { |
| 429 foreach term [split $val] { |
| 430 lappend flags $term |
| 431 set allflags($term) 1 |
| 432 } |
| 433 } else { |
| 434 error "bad pragma_def line: $line" |
| 435 } |
| 436 } |
| 437 record_one |
| 438 set allnames [lsort [array names allbyname]] |
| 439 |
| 440 # Generate #defines for all pragma type names. Group the pragmas that are |
| 441 # omit in default builds (defined(SQLITE_DEBUG) and defined(SQLITE_HAS_CODEC)) |
| 442 # at the end. |
| 443 # |
| 444 puts $fd "\n/* The various pragma types */" |
| 445 set pnum 0 |
| 446 foreach name $allnames { |
| 447 set type [lindex $allbyname($name) 0] |
| 448 if {[info exists seentype($type)]} continue |
| 449 set if [lindex $allbyname($name) 2] |
| 450 if {[regexp SQLITE_DEBUG $if] || [regexp SQLITE_HAS_CODEC $if]} continue |
| 451 set seentype($type) 1 |
| 452 puts $fd [format {#define %-35s %4d} PragTyp_$type $pnum] |
| 453 incr pnum |
| 454 } |
| 455 foreach name $allnames { |
| 456 set type [lindex $allbyname($name) 0] |
| 457 if {[info exists seentype($type)]} continue |
| 458 set if [lindex $allbyname($name) 2] |
| 459 if {[regexp SQLITE_DEBUG $if]} continue |
| 460 set seentype($type) 1 |
| 461 puts $fd [format {#define %-35s %4d} PragTyp_$type $pnum] |
| 462 incr pnum |
| 463 } |
| 464 foreach name $allnames { |
| 465 set type [lindex $allbyname($name) 0] |
| 466 if {[info exists seentype($type)]} continue |
| 467 set seentype($type) 1 |
| 468 puts $fd [format {#define %-35s %4d} PragTyp_$type $pnum] |
| 469 incr pnum |
| 470 } |
| 471 |
| 472 # Generate #defines for flags |
| 473 # |
| 474 puts $fd "\n/* Property flags associated with various pragma. */" |
| 475 set fv 1 |
| 476 foreach f [lsort [array names allflags]] { |
| 477 puts $fd [format {#define PragFlg_%-10s 0x%02x /* %s */} \ |
| 478 $f $fv $flagMeaning($f)] |
| 479 set fv [expr {$fv*2}] |
| 480 } |
| 481 |
| 482 # Generate the array of column names used by pragmas that act like |
| 483 # queries. |
| 484 # |
| 485 puts $fd "\n/* Names of columns for pragmas that return multi-column result" |
| 486 puts $fd "** or that return single-column results where the name of the" |
| 487 puts $fd "** result column is different from the name of the pragma\n*/" |
| 488 puts $fd "static const char *const pragCName\[\] = {" |
| 489 set offset 0 |
| 490 foreach cols $cols_list { |
| 491 set cols_offset($allcols($cols)) $offset |
| 492 set ub " /* Used by: $colUsedBy($cols) */" |
| 493 foreach c $cols { |
| 494 puts $fd [format " /* %3d */ %-14s%s" $offset \"$c\", $ub] |
| 495 set ub "" |
| 496 incr offset |
| 497 } |
| 498 } |
| 499 puts $fd "\175;" |
| 500 |
| 501 # Generate the lookup table |
| 502 # |
| 503 puts $fd "\n/* Definitions of all built-in pragmas */" |
| 504 puts $fd "typedef struct PragmaName \173" |
| 505 puts $fd " const char *const zName; /* Name of pragma */" |
| 506 puts $fd " u8 ePragTyp; /* PragTyp_XXX value */" |
| 507 puts $fd " u8 mPragFlg; /* Zero or more PragFlg_XXX values */" |
| 508 puts $fd { u8 iPragCName; /* Start of column names in pragCName[] */} |
| 509 puts $fd " u8 nPragCName; \ |
| 510 /* Num of col names. 0 means use pragma name */" |
| 511 puts $fd " u32 iArg; /* Extra argument */" |
| 512 puts $fd "\175 PragmaName;" |
| 513 puts $fd "static const PragmaName aPragmaName\[\] = \173" |
| 514 |
| 515 set current_if {} |
| 516 set spacer [format { %26s } {}] |
| 517 foreach name $allnames { |
| 518 foreach {type arg if flag cx} $allbyname($name) break |
| 519 if {$cx==0} { |
| 520 set cy 0 |
| 521 set nx 0 |
| 522 } else { |
| 523 set cy $cols_offset($cx) |
| 524 set nx [llength [lindex $cols_list [expr {$cx-1}]]] |
| 525 } |
| 526 if {$if!=$current_if} { |
| 527 if {$current_if!=""} { |
| 528 foreach this_if $current_if { |
| 529 puts $fd "#endif" |
| 530 } |
| 531 } |
| 532 set current_if $if |
| 533 if {$current_if!=""} { |
| 534 foreach this_if $current_if { |
| 535 puts $fd "#if $this_if" |
| 536 } |
| 537 } |
| 538 } |
| 539 set typex [format PragTyp_%-23s $type,] |
| 540 if {$flag==""} { |
| 541 set flagx "0" |
| 542 } else { |
| 543 set flagx PragFlg_[join $flag {|PragFlg_}] |
| 544 } |
| 545 puts $fd " \173/* zName: */ \"$name\"," |
| 546 puts $fd " /* ePragTyp: */ PragTyp_$type," |
| 547 puts $fd " /* ePragFlg: */ $flagx," |
| 548 puts $fd " /* ColNames: */ $cy, $nx," |
| 549 puts $fd " /* iArg: */ $arg \175," |
| 550 } |
| 551 if {$current_if!=""} { |
| 552 foreach this_if $current_if { |
| 553 puts $fd "#endif" |
| 554 } |
| 555 } |
| 556 puts $fd "\175;" |
| 557 |
| 558 # count the number of pragmas, for information purposes |
| 559 # |
| 560 set allcnt 0 |
| 561 set dfltcnt 0 |
| 562 foreach name $allnames { |
| 563 incr allcnt |
| 564 set if [lindex $allbyname($name) 2] |
| 565 if {[regexp {^defined} $if] || [regexp {[^!]defined} $if]} continue |
| 566 incr dfltcnt |
| 567 } |
| 568 puts $fd "/* Number of pragmas: $dfltcnt on by default, $allcnt total. */" |
OLD | NEW |