Documentation Source Text

Check-in [ddb4bf4fcf]
Login

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

Overview
Comment:Use the same "tclsh.docsrc" binary for everything.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ddb4bf4fcf1f3ada5ba1689efbc726e562dd68bd
User & Date: drh 2016-08-29 20:22:29
Context
2016-08-29
20:37
Make the search box always go to the "search" script in the root of the site, not to "/search". This enables the "search" script to work on /draft. check-in: bd7343390c user: drh tags: trunk
20:22
Use the same "tclsh.docsrc" binary for everything. check-in: ddb4bf4fcf user: drh tags: trunk
20:18
Add the $(TCLINC) to the arguments to build tclsh.docsrc Closed-Leaf check-in: 8d6ba1bfab user: drh tags: experimental
18:57
Include the TCL include path when building the searchdb target. check-in: 8e290154f5 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to main.mk.

22
23
24
25
26
27
28


29
30
31
32
33
34
35
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
..
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#
# CC               A C-compiler and arguments for building utility programs
#
# Once the macros above are defined, the rest of this make script will
# build the SQLite library and testing tools.
################################################################################



default:	
	@echo 'make base;       # Build base documents'
	@echo 'make evidence;   # Gather evidence marks'
	@echo 'make matrix;     # Build the traceability matrix'
	@echo 'make all;        # Do all of the above'
	@echo 'make spell;      # Spell check generated docs'
	@echo 'make fast;       # Build documentation only - no requirements'
................................................................................

all:	base evidence format_evidence matrix doc

private:	base evidence private_evidence matrix doc

fast:	base doc

tclsh:	$(TCLSQLITE3C)
	$(CC) -g -o tclsh -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS5 -DTCLSH=1 -DSQLITE_TCLMD5 $(TCLINC) $(TCLSQLITE3C) $(TCLFLAGS)



sqlite3.h:	tclsh $(SRC)/src/sqlite.h.in $(SRC)/manifest.uuid $(SRC)/VERSION
	./tclsh $(SRC)/tool/mksqlite3h.tcl $(SRC) | \
	sed 's/^SQLITE_API //' >sqlite3.h

# Generate the directory into which generated documentation files will
# be written.
#
docdir:
	mkdir -p doc doc/c3ref doc/matrix doc/matrix/c3ref doc/matrix/syntax
................................................................................

# This rule generates all documention files from their sources.  The
# special markup on HTML files used to identify testable statements and
# requirements are retained in the HTML and so the HTML generated by
# this rule is not suitable for publication.  This is the first step
# only.
#
base:	tclsh sqlite3.h docdir always parsehtml.so
	rm -rf doc/images
	cp -r $(DOC)/images doc
	mkdir doc/images/syntax
	cp $(DOC)/art/syntax/*.gif doc/images/syntax
	cp $(DOC)/rawpages/* doc
	./tclsh $(DOC)/wrap.tcl $(DOC) $(SRC) doc $(DOC)/pages/*.in
	cp doc/fileformat2.html doc/fileformat.html

# Strip the special markup in HTML files that identifies testable statements
# and requirements.
#
doc:	always $(DOC)/remove_carets.sh
	sh $(DOC)/remove_carets.sh doc
................................................................................
# Spell check generated docs.
#
spell: $(DOC)/spell_chk.sh $(DOC)/custom.txt
	sh $(DOC)/spell_chk.sh doc '*.html' $(DOC)/custom.txt

# Construct the database schema.
#
schema:	tclsh
	./tclsh $(DOC)/schema.tcl

# The following rule scans sqlite3.c source text, the text of the TCL
# test cases, and (optionally) the TH3 test case sources looking for
# comments that identify assertions and test cases that provide evidence
# that SQLite behaves as it says it does.  See the comments in 
# scan_test_cases.tcl for additional information.
#
# The output file evidence.txt is used by requirements coverage analysis.
#
SCANNER = $(DOC)/scan_test_cases.tcl

evidence:	tclsh
	./tclsh $(SCANNER) -reset src $(SRC)/src/*.[chy]
	./tclsh $(SCANNER) src $(SRC)/ext/fts3/*.[ch]
	./tclsh $(SCANNER) src $(SRC)/ext/rtree/*.[ch]
	./tclsh $(SCANNER) tcl $(SRC)/test/*.test
	if test '' != '$(TH3)'; then \
	  ./tclsh $(SCANNER) th3 $(TH3)/mkth3.tcl; \
	  ./tclsh $(SCANNER) th3 $(TH3)/base/*.c; \
	  ./tclsh $(SCANNER) th3/req1 $(TH3)/req1/*.test; \
	  ./tclsh $(SCANNER) th3/cov1 $(TH3)/cov1/*.test; \
	  ./tclsh $(SCANNER) th3/stress $(TH3)/stress/*.test; \
	fi
	if test '' != '$(SLT)'; then \
	  ./tclsh $(SCANNER) slt $(SLT)/test/evidence/*.test; \
	fi

# Copy and HTMLize evidence files
#
FMT = $(DOC)/format_evidence.tcl

format_evidence: tclsh
	rm -fr doc/matrix/ev/*
	./tclsh $(FMT) src doc/matrix $(SRC)/src/*.[chy]
	./tclsh $(FMT) src doc/matrix $(SRC)/ext/fts3/*.[ch]
	./tclsh $(FMT) src doc/matrix $(SRC)/ext/rtree/*.[ch]
	./tclsh $(FMT) tcl doc/matrix $(SRC)/test/*.test
	if test '' != '$(SLT)'; then \
	  ./tclsh $(FMT) slt doc/matrix $(SLT)/test/evidence/*.test; \
	fi

private_evidence: format_evidence
	./tclsh $(FMT) th3 doc/matrix $(TH3)/mkth3.tcl
	./tclsh $(FMT) th3/req1 doc/matrix $(TH3)/req1/*.test
	./tclsh $(FMT) th3/cov1 doc/matrix $(TH3)/cov1/*.test

# Generate the traceability matrix
#
matrix:	
	rm -rf doc/matrix/images
	cp -r doc/images doc/matrix
	./tclsh $(DOC)/matrix.tcl


#-------------------------------------------------------------------------

# Source files for the [tclsqlite3.search] executable. 
#
SSRC = $(DOC)/search/searchc.c \
	    $(DOC)/search/parsehtml.c \
	    $(DOC)/search/fts5ext.c \
	    $(TCLSQLITE3C)

# Flags to build [tclsqlite3.search] with.
#
SFLAGS = $(TCLINC) -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_FTS5

tclsqlite3.search: $(SSRC)
	$(CC) -static -O2 -o $@ -I. $(SFLAGS) $(SSRC) $(STATICTCLFLAGS)

searchdb: tclsqlite3.search
	./tclsqlite3.search $(DOC)/search/buildsearchdb.tcl
	cp $(DOC)/document_header.tcl doc/document_header.tcl
	cp $(DOC)/search/search.tcl doc/search
	chmod +x doc/search

always:	

clean:	
	rm -rf tclsh doc sqlite3.h







>
>







 







<
<
<
<
<
|
|







 







|





|







 







|
|











|
|
|
|
|

|
|
|
|
|


|






|

|
|
|
|

|



|
|
|






|













|

|
|

|
|







|
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
..
39
40
41
42
43
44
45





46
47
48
49
50
51
52
53
54
..
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
..
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#
# CC               A C-compiler and arguments for building utility programs
#
# Once the macros above are defined, the rest of this make script will
# build the SQLite library and testing tools.
################################################################################

TCLSH = tclsh.docsrc

default:	
	@echo 'make base;       # Build base documents'
	@echo 'make evidence;   # Gather evidence marks'
	@echo 'make matrix;     # Build the traceability matrix'
	@echo 'make all;        # Do all of the above'
	@echo 'make spell;      # Spell check generated docs'
	@echo 'make fast;       # Build documentation only - no requirements'
................................................................................

all:	base evidence format_evidence matrix doc

private:	base evidence private_evidence matrix doc

fast:	base doc






sqlite3.h: $(TCLSH) $(SRC)/src/sqlite.h.in $(SRC)/manifest.uuid $(SRC)/VERSION
	./$(TCLSH) $(SRC)/tool/mksqlite3h.tcl $(SRC) | \
	sed 's/^SQLITE_API //' >sqlite3.h

# Generate the directory into which generated documentation files will
# be written.
#
docdir:
	mkdir -p doc doc/c3ref doc/matrix doc/matrix/c3ref doc/matrix/syntax
................................................................................

# This rule generates all documention files from their sources.  The
# special markup on HTML files used to identify testable statements and
# requirements are retained in the HTML and so the HTML generated by
# this rule is not suitable for publication.  This is the first step
# only.
#
base:	$(TCLSH) sqlite3.h docdir always 
	rm -rf doc/images
	cp -r $(DOC)/images doc
	mkdir doc/images/syntax
	cp $(DOC)/art/syntax/*.gif doc/images/syntax
	cp $(DOC)/rawpages/* doc
	./$(TCLSH) $(DOC)/wrap.tcl $(DOC) $(SRC) doc $(DOC)/pages/*.in
	cp doc/fileformat2.html doc/fileformat.html

# Strip the special markup in HTML files that identifies testable statements
# and requirements.
#
doc:	always $(DOC)/remove_carets.sh
	sh $(DOC)/remove_carets.sh doc
................................................................................
# Spell check generated docs.
#
spell: $(DOC)/spell_chk.sh $(DOC)/custom.txt
	sh $(DOC)/spell_chk.sh doc '*.html' $(DOC)/custom.txt

# Construct the database schema.
#
schema:	$(TCLSH)
	./$(TCLSH) $(DOC)/schema.tcl

# The following rule scans sqlite3.c source text, the text of the TCL
# test cases, and (optionally) the TH3 test case sources looking for
# comments that identify assertions and test cases that provide evidence
# that SQLite behaves as it says it does.  See the comments in 
# scan_test_cases.tcl for additional information.
#
# The output file evidence.txt is used by requirements coverage analysis.
#
SCANNER = $(DOC)/scan_test_cases.tcl

evidence:	$(TCLSH)
	./$(TCLSH) $(SCANNER) -reset src $(SRC)/src/*.[chy]
	./$(TCLSH) $(SCANNER) src $(SRC)/ext/fts3/*.[ch]
	./$(TCLSH) $(SCANNER) src $(SRC)/ext/rtree/*.[ch]
	./$(TCLSH) $(SCANNER) tcl $(SRC)/test/*.test
	if test '' != '$(TH3)'; then \
	  ./$(TCLSH) $(SCANNER) th3 $(TH3)/mkth3.tcl; \
	  ./$(TCLSH) $(SCANNER) th3 $(TH3)/base/*.c; \
	  ./$(TCLSH) $(SCANNER) th3/req1 $(TH3)/req1/*.test; \
	  ./$(TCLSH) $(SCANNER) th3/cov1 $(TH3)/cov1/*.test; \
	  ./$(TCLSH) $(SCANNER) th3/stress $(TH3)/stress/*.test; \
	fi
	if test '' != '$(SLT)'; then \
	  ./$(TCLSH) $(SCANNER) slt $(SLT)/test/evidence/*.test; \
	fi

# Copy and HTMLize evidence files
#
FMT = $(DOC)/format_evidence.tcl

format_evidence: $(TCLSH)
	rm -fr doc/matrix/ev/*
	./$(TCLSH) $(FMT) src doc/matrix $(SRC)/src/*.[chy]
	./$(TCLSH) $(FMT) src doc/matrix $(SRC)/ext/fts3/*.[ch]
	./$(TCLSH) $(FMT) src doc/matrix $(SRC)/ext/rtree/*.[ch]
	./$(TCLSH) $(FMT) tcl doc/matrix $(SRC)/test/*.test
	if test '' != '$(SLT)'; then \
	  ./$(TCLSH) $(FMT) slt doc/matrix $(SLT)/test/evidence/*.test; \
	fi

private_evidence: format_evidence
	./$(TCLSH) $(FMT) th3 doc/matrix $(TH3)/mkth3.tcl
	./$(TCLSH) $(FMT) th3/req1 doc/matrix $(TH3)/req1/*.test
	./$(TCLSH) $(FMT) th3/cov1 doc/matrix $(TH3)/cov1/*.test

# Generate the traceability matrix
#
matrix:	
	rm -rf doc/matrix/images
	cp -r doc/images doc/matrix
	./$(TCLSH) $(DOC)/matrix.tcl


#-------------------------------------------------------------------------

# Source files for the [tclsqlite3.search] executable. 
#
SSRC = $(DOC)/search/searchc.c \
	    $(DOC)/search/parsehtml.c \
	    $(DOC)/search/fts5ext.c \
	    $(TCLSQLITE3C)

# Flags to build [tclsqlite3.search] with.
#
SFLAGS = $(TCLINC) -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_FTS5 -DSQLITE_TCLMD5 -DTCLSH -Dmain=xmain

$(TCLSH): $(SSRC)
	$(CC) -O2 -o $@ -I. $(SFLAGS) $(SSRC) $(TCLFLAGS)

searchdb: $(TCLSH)
	./$(TCLSH) $(DOC)/search/buildsearchdb.tcl
	cp $(DOC)/document_header.tcl doc/document_header.tcl
	cp $(DOC)/search/search.tcl doc/search
	chmod +x doc/search

always:	

clean:	
	rm -rf $(TCLSH) doc sqlite3.h

Changes to search/search.tcl.

1
2
3
4
5
6
7
8
#!/usr/bin/tclsqlite3.search

source [file dirname [info script]]/document_header.tcl

# Decode an HTTP %-encoded string
#
proc percent_decode {str} {
    # rewrite "+" back to space
|







1
2
3
4
5
6
7
8
#!/usr/bin/tclsh.docsrc

source [file dirname [info script]]/document_header.tcl

# Decode an HTTP %-encoded string
#
proc percent_decode {str} {
    # rewrite "+" back to space

Changes to search/searchc.c.

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

#include <sqlite3.h>
#include <tcl.h>

int Sqlite3_Init(Tcl_Interp*);
int Parsehtml_Init(Tcl_Interp*);
int Fts5ext_Init(Tcl_Interp*);





static int AppInit(Tcl_Interp *interp) {
  int rc;
  rc = Sqlite3_Init(interp);
  if( rc!=TCL_OK ) return rc;

  rc = Parsehtml_Init(interp);
  if( rc!=TCL_OK ) return rc;

  rc = Fts5ext_Init(interp);
  if( rc!=TCL_OK ) return rc;






  return TCL_OK;
}





int main(int argc, char *argv[]) {
  Tcl_Main(argc, argv, AppInit);
  return 0;
}








>
>
>
>











>
>
>
>
>



>
>
>
>






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

#include <sqlite3.h>
#include <tcl.h>

int Sqlite3_Init(Tcl_Interp*);
int Parsehtml_Init(Tcl_Interp*);
int Fts5ext_Init(Tcl_Interp*);

#ifdef SQLITE_TCLMD5
int Md5_Init(Tcl_Interp*);
#endif

static int AppInit(Tcl_Interp *interp) {
  int rc;
  rc = Sqlite3_Init(interp);
  if( rc!=TCL_OK ) return rc;

  rc = Parsehtml_Init(interp);
  if( rc!=TCL_OK ) return rc;

  rc = Fts5ext_Init(interp);
  if( rc!=TCL_OK ) return rc;

#ifdef SQLITE_TCLMD5
  rc = Md5_Init(interp);
  if( rc!=TCL_OK ) return rc;
#endif

  return TCL_OK;
}

#ifdef main
# undef main
#endif

int main(int argc, char *argv[]) {
  Tcl_Main(argc, argv, AppInit);
  return 0;
}