/ Check-in [e32b69d7]
Login

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

Overview
Comment:Add script to amalgamate all LSM files into "lsm1.c".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e32b69d73062e233b0ac853611d10b24546a346a603289ab0e339a3604ae2af4
User & Date: dan 2017-12-13 14:22:48
Context
2017-12-13
15:32
Change some LSM code internal typenames from "Blob" and "Pgno" to "LsmBlob" and "LsmPgno". This allows the LSM code to be compiled as a single unit with sqlite3.c. check-in: 30bf38d5 user: dan tags: trunk
14:22
Add script to amalgamate all LSM files into "lsm1.c". check-in: e32b69d7 user: dan tags: trunk
10:11
Minor enhancement to two assert() statements in the default VFSes. check-in: 9cede8a8 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added ext/lsm1/tool/mklsm1c.tcl.

            1  +#!/bin/sh
            2  +# restart with tclsh \
            3  +exec tclsh "$0" "$@"
            4  +
            5  +set srcdir [file dirname [file dirname [info script]]]
            6  +set G(src) [string map [list %dir% $srcdir] {
            7  +  %dir%/lsm.h
            8  +  %dir%/lsmInt.h
            9  +  %dir%/lsm_vtab.c
           10  +  %dir%/lsm_ckpt.c
           11  +  %dir%/lsm_file.c
           12  +  %dir%/lsm_log.c
           13  +  %dir%/lsm_main.c
           14  +  %dir%/lsm_mem.c
           15  +  %dir%/lsm_mutex.c
           16  +  %dir%/lsm_shared.c
           17  +  %dir%/lsm_sorted.c
           18  +  %dir%/lsm_str.c
           19  +  %dir%/lsm_tree.c
           20  +  %dir%/lsm_unix.c
           21  +  %dir%/lsm_varint.c
           22  +  %dir%/lsm_win32.c
           23  +}]
           24  +
           25  +set G(hdr) {
           26  +
           27  +#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_LSM1) 
           28  +
           29  +#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) 
           30  +# define NDEBUG 1
           31  +#endif
           32  +#if defined(NDEBUG) && defined(SQLITE_DEBUG)
           33  +# undef NDEBUG
           34  +#endif
           35  +
           36  +}
           37  +
           38  +set G(footer) {
           39  +    
           40  +#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_LSM1) */
           41  +}
           42  +
           43  +#-------------------------------------------------------------------------
           44  +# Read and return the entire contents of text file $zFile from disk.
           45  +#
           46  +proc readfile {zFile} {
           47  +  set fd [open $zFile]
           48  +  set data [read $fd]
           49  +  close $fd
           50  +  return $data
           51  +}
           52  +
           53  +proc lsm1c_init {zOut} {
           54  +  global G
           55  +  set G(fd) stdout
           56  +  set G(fd) [open $zOut w]
           57  +
           58  +  puts -nonewline $G(fd) $G(hdr)
           59  +}
           60  +
           61  +proc lsm1c_printfile {zIn} {
           62  +  global G
           63  +  set data [readfile $zIn]
           64  +  set zTail [file tail $zIn]
           65  +  puts $G(fd) "#line 1 \"$zTail\""
           66  +
           67  +  foreach line [split $data "\n"] {
           68  +    if {[regexp {^# *include.*lsm} $line]} {
           69  +      set line "/* $line */"
           70  +    } elseif { [regexp {^(const )?[a-zA-Z][a-zA-Z0-9]* [*]?lsm[^_]} $line] } {
           71  +      set line "static $line"
           72  +    }
           73  +    puts $G(fd) $line
           74  +  }
           75  +}
           76  +
           77  +proc lsm1c_close {} {
           78  +  global G
           79  +  puts -nonewline $G(fd) $G(footer)
           80  +  if {$G(fd)!="stdout"} {
           81  +    close $G(fd)
           82  +  }
           83  +}
           84  +
           85  +
           86  +lsm1c_init lsm1.c
           87  +foreach f $G(src) { lsm1c_printfile $f }
           88  +lsm1c_close

Changes to main.mk.

   259    259      fts5parse.c \
   260    260      $(TOP)/ext/fts5/fts5_storage.c \
   261    261      $(TOP)/ext/fts5/fts5_tokenize.c \
   262    262      $(TOP)/ext/fts5/fts5_unicode2.c \
   263    263      $(TOP)/ext/fts5/fts5_varint.c \
   264    264      $(TOP)/ext/fts5/fts5_vocab.c  \
   265    265   
          266  +LSM1_SRC = \
          267  +   $(TOP)/ext/lsm1/lsm.h \
          268  +   $(TOP)/ext/lsm1/lsmInt.h \
          269  +   $(TOP)/ext/lsm1/lsm_ckpt.c \
          270  +   $(TOP)/ext/lsm1/lsm_file.c \
          271  +   $(TOP)/ext/lsm1/lsm_log.c \
          272  +   $(TOP)/ext/lsm1/lsm_main.c \
          273  +   $(TOP)/ext/lsm1/lsm_mem.c \
          274  +   $(TOP)/ext/lsm1/lsm_mutex.c \
          275  +   $(TOP)/ext/lsm1/lsm_shared.c \
          276  +   $(TOP)/ext/lsm1/lsm_sorted.c \
          277  +   $(TOP)/ext/lsm1/lsm_str.c \
          278  +   $(TOP)/ext/lsm1/lsm_tree.c \
          279  +   $(TOP)/ext/lsm1/lsm_unix.c \
          280  +   $(TOP)/ext/lsm1/lsm_varint.c \
          281  +   $(TOP)/ext/lsm1/lsm_vtab.c \
          282  +   $(TOP)/ext/lsm1/lsm_win32.c
          283  +
   266    284   
   267    285   # Generated source code files
   268    286   #
   269    287   SRC += \
   270    288     keywordhash.h \
   271    289     opcodes.c \
   272    290     opcodes.h \
................................................................................
   762    780   
   763    781   fts5parse.h: fts5parse.c
   764    782   
   765    783   fts5.c: $(FTS5_SRC) $(FTS5_HDR)
   766    784   	tclsh $(TOP)/ext/fts5/tool/mkfts5c.tcl
   767    785   	cp $(TOP)/ext/fts5/fts5.h .
   768    786   
          787  +lsm1.c: $(LSM1_SRC)
          788  +	tclsh $(TOP)/ext/lsm1/tool/mklsm1c.tcl
          789  +	cp $(TOP)/ext/lsm1/lsm.h .
          790  +
   769    791   userauth.o:	$(TOP)/ext/userauth/userauth.c $(HDR) $(EXTHDR)
   770    792   	$(TCCX) -DSQLITE_CORE -c $(TOP)/ext/userauth/userauth.c
   771    793   
   772    794   sqlite3session.o:	$(TOP)/ext/session/sqlite3session.c $(HDR) $(EXTHDR)
   773    795   	$(TCCX) -DSQLITE_CORE -c $(TOP)/ext/session/sqlite3session.c
   774    796   
   775    797   sqlite3rbu.o:	$(TOP)/ext/rbu/sqlite3rbu.c $(HDR) $(EXTHDR)
................................................................................
  1015   1037   	rm -f sqlite3_analyzer sqlite3_analyzer.exe sqlite3_analyzer.c
  1016   1038   	rm -f sqlite-*-output.vsix
  1017   1039   	rm -f mptester mptester.exe
  1018   1040   	rm -f fuzzershell fuzzershell.exe
  1019   1041   	rm -f fuzzcheck fuzzcheck.exe
  1020   1042   	rm -f sqldiff sqldiff.exe
  1021   1043   	rm -f fts5.* fts5parse.*
         1044  +	rm -f lsm.h lsm1.c