/ Check-in [6c53c740]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the shell.c.in amalgamator script so that it avoids generating redundant typedef statements.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6c53c740cb4f62305689ea0a73beca83e71ed86707094e850bed975965c8c9f2
User & Date: drh 2018-01-05 20:30:54
Context
2018-01-05
21:01
Make sure i64 and u64 typedefs are available throughout shell.c. check-in: 656fb5aa user: drh tags: trunk
20:30
Fix the shell.c.in amalgamator script so that it avoids generating redundant typedef statements. check-in: 6c53c740 user: drh tags: trunk
20:26
MinGW does not define the S_ISLNK macro; therefore, define it in the shell when needed. check-in: 73023feb user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tool/mkshellc.tcl.

    26     26   ** source file to help make the command-line program easier to compile.
    27     27   **
    28     28   ** To modify this program, get a copy of the canonical SQLite source tree,
    29     29   ** edit the src/shell.c.in" and/or some of the other files that are included
    30     30   ** by "src/shell.c.in", then rerun the tool/mkshellc.tcl script.
    31     31   */}
    32     32   set in [open $topdir/src/shell.c.in rb]
           33  +proc omit_redundant_typedefs {line} {
           34  +  global typedef_seen
           35  +  if {[regexp {^typedef .*;} $line]} {
           36  +    if {[info exists typedef_seen($line)]} {
           37  +      return "/* $line */"
           38  +    }
           39  +    set typedef_seen($line) 1
           40  +  }
           41  +  return $line
           42  +}
    33     43   while {1} {
    34         -  set lx [gets $in]
           44  +  set lx [omit_redundant_typedefs [gets $in]]
    35     45     if {[eof $in]} break;
    36     46     if {[regexp {^INCLUDE } $lx]} {
    37     47       set cfile [lindex $lx 1]
    38     48       puts $out "/************************* Begin $cfile ******************/"
    39     49       set in2 [open $topdir/src/$cfile rb]
    40     50       while {![eof $in2]} {
    41         -      set lx [gets $in2]
           51  +      set lx [omit_redundant_typedefs [gets $in2]]
    42     52         if {[regexp {^#include "sqlite} $lx]} continue
    43     53         set lx [string map [list __declspec(dllexport) {}] $lx]
    44     54         puts $out $lx
    45     55       }
    46     56       close $in2
    47     57       puts $out "/************************* End $cfile ********************/"
    48     58       continue
    49     59     }
    50     60     puts $out $lx
    51     61   }
    52     62   close $in
    53     63   close $out