SQLite

Check-in [7f4810747b]
Login

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

Overview
Comment:Instead of adding SQLITE_API macros sqlite3.h while creating sqlite3.c, add them as part of generating the sqlite3.h target, while copying from sqlite.h.in to sqlite3.h. This fixes a build problem that was causing multiple SQLITE_API macros to be added to a single line of sqlite3.h, and the problem cited by #4016. (CVS 6971)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7f4810747b0864981f27edbd504bfab2efea1e3c
User & Date: danielk1977 2009-08-11 05:50:37.000
References
2020-11-24
13:14
Remove the VERSION_NUMBER macro from configure.ac as it has been unused since 2009 check-in [7f4810747b086498]. See also forum post bb2c634fcd. (check-in: 5466dd55d4 user: drh tags: trunk)
Context
2009-08-13
15:13
Fix a typo on a comment in sqlite3VdbeIntegerAffinity(). (check-in: b5a709d360 user: drh tags: trunk)
2009-08-12
11:45
Make sure the large-file support macros occur first in sqliteInt.h. Fix for CVSTrac ticket #4022. (check-in: b0848925ba user: drh tags: trunk, cvs-to-fossil-cutover)
2009-08-11
05:50
Instead of adding SQLITE_API macros sqlite3.h while creating sqlite3.c, add them as part of generating the sqlite3.h target, while copying from sqlite.h.in to sqlite3.h. This fixes a build problem that was causing multiple SQLITE_API macros to be added to a single line of sqlite3.h, and the problem cited by #4016. (CVS 6971) (check-in: 7f4810747b user: danielk1977 tags: trunk)
2009-08-10
17:48
Reduce the maximum supported sector size to 64KiB. (CVS 6970) (check-in: 8e1e0ba292 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to Makefile.in.
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
select.lo:	$(TOP)/src/select.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/select.c

status.lo:	$(TOP)/src/status.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/status.c

sqlite3.h:	$(TOP)/src/sqlite.h.in 
	sed -e s/--VERS--/$(RELEASE)/ $(TOP)/src/sqlite.h.in | \
	sed -e s/--VERSION-NUMBER--/$(VERSION_NUMBER)/ >sqlite3.h

table.lo:	$(TOP)/src/table.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/table.c

tclsqlite.lo:	$(TOP)/src/tclsqlite.c $(HDR)
	$(LTCOMPILE) -DUSE_TCL_STUBS=1 -c $(TOP)/src/tclsqlite.c








|
<







679
680
681
682
683
684
685
686

687
688
689
690
691
692
693
select.lo:	$(TOP)/src/select.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/select.c

status.lo:	$(TOP)/src/status.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/status.c

sqlite3.h:	$(TOP)/src/sqlite.h.in 
	cat $(TOP)/src/sqlite.h.in | tclsh $(TOP)/tool/mksqlite3h.tcl `cat ${TOP}/VERSION` > sqlite3.h


table.lo:	$(TOP)/src/table.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/table.c

tclsqlite.lo:	$(TOP)/src/tclsqlite.c $(HDR)
	$(LTCOMPILE) -DUSE_TCL_STUBS=1 -c $(TOP)/src/tclsqlite.c

Changes to main.mk.
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
	cp $(TOP)/src/parse.y .
	rm -f parse.h
	./lemon $(OPTS) parse.y
	mv parse.h parse.h.temp
	awk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h

sqlite3.h:	$(TOP)/src/sqlite.h.in 
	sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \
	    -e s/--VERSION-NUMBER--/`cat ${TOP}/VERSION | sed 's/[^0-9]/ /g' | $(NAWK) '{printf "%d%03d%03d",$$1,$$2,$$3}'`/ \
                 $(TOP)/src/sqlite.h.in >sqlite3.h

keywordhash.h:	$(TOP)/tool/mkkeywordhash.c
	$(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
	./mkkeywordhash >keywordhash.h










<
<
|







385
386
387
388
389
390
391


392
393
394
395
396
397
398
399
	cp $(TOP)/src/parse.y .
	rm -f parse.h
	./lemon $(OPTS) parse.y
	mv parse.h parse.h.temp
	awk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h

sqlite3.h:	$(TOP)/src/sqlite.h.in 


	cat $(TOP)/src/sqlite.h.in | tclsh $(TOP)/tool/mksqlite3h.tcl `cat ${TOP}/VERSION` > sqlite3.h

keywordhash.h:	$(TOP)/tool/mkkeywordhash.c
	$(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
	./mkkeywordhash >keywordhash.h



Changes to tool/mksqlite3c.tcl.
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
   icu.c
   fts3_icu.c
} {
  copy_file tsrc/$file
}

close $out

# This block overwrites the copy of sqlite3.h in the current directory.
#
# It copies tsrc/sqlite3.h to ./sqlite3.h, adding SQLITE_API in front of the
# API functions and global variables as it goes. 
#
set fd_in [open tsrc/sqlite3.h r]
set fd_out [open sqlite3.h w]
while {![eof $fd_in]} {
  set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+sqlite3_[_a-zA-Z0-9]+(\[|;| =)}
  set declpattern {^ *[a-zA-Z][a-zA-Z_0-9 ]+ \**sqlite3_[_a-zA-Z0-9]+\(}

  set line [gets $fd_in]
  if {[regexp {define SQLITE_EXTERN extern} $line]} {
    puts $fd_out $line
    puts $fd_out [gets $fd_in]
    puts $fd_out ""
    puts $fd_out "#ifndef SQLITE_API"
    puts $fd_out "# define SQLITE_API"
    puts $fd_out "#endif"
    set line ""
  }

  if {([regexp $varpattern $line] && ![regexp {^ *typedef} $line])
   || ([regexp $declpattern $line])
  } {
    set line "SQLITE_API $line"
  }
  puts $fd_out $line
}
close $fd_out
close $fd_in









<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

300
301
302
303
304
305
306

































307
   icu.c
   fts3_icu.c
} {
  copy_file tsrc/$file
}

close $out


































Added tool/mksqlite3h.tcl.






























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/tclsh
#
# This script performs processing on src/sqlite.h.in. It:
#
#   1) Adds SQLITE_EXTERN in front of the declaration of global variables,
#   2) Adds SQLITE_API in front of the declaration of API functions,
#   3) Replaces the string --VERS-- with the current library version, 
#      formatted as a string (e.g. "3.6.17"), and
#   4) Replaces the string --VERSION-NUMBER-- with current library version,
#      formatted as an integer (e.g. "3006017").
#
# This script reads from stdin, and outputs to stdout. The current library
# version number should be passed as the only argument. Example invocation:
#
#   cat sqlite.h.in | mksqlite3h.tcl 3.6.17 > sqlite3.h
#

set zVersion [lindex $argv 0]
set nVersion [eval format "%d%03d%03d" [split $zVersion .]]

while {![eof stdin]} {
  set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+sqlite3_[_a-zA-Z0-9]+(\[|;| =)}
  set declpattern {^ *[a-zA-Z][a-zA-Z_0-9 ]+ \**sqlite3_[_a-zA-Z0-9]+\(}

  set line [gets stdin]

  regsub -- --VERS--           $line $zVersion line
  regsub -- --VERSION-NUMBER-- $line $nVersion line

  if {[regexp {define SQLITE_EXTERN extern} $line]} {
    puts $line
    puts [gets stdin]
    puts ""
    puts "#ifndef SQLITE_API"
    puts "# define SQLITE_API"
    puts "#endif"
    set line ""
  }

  if {([regexp $varpattern $line] && ![regexp {^ *typedef} $line])
   || ([regexp $declpattern $line])
  } {
    set line "SQLITE_API $line"
  }
  puts $line
}