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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
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
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
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
|
-
-
-
+
+
+
-
+
-
+
+
-
-
-
+
+
+
-
-
-
+
-
-
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
|
source tree. The src/ subdirectory contains all code, including
the code for the separate preprocessor programs.
Each preprocessor program is a separate C program implemented in
a single file of C source code. The three preprocessor programs
are:
1. mkindex.c
2. translate.c
3. makeheaders.c
1. [/file/src/mkindex.c | mkindex.c]
2. [/file/src/translate.c | translate.c]
3. [/file/src/makeheaders.c | makeheaders.c]
Fossil makes use of [http://www.sqlite.org/ | SQLite] for on-disk
Fossil uses [http://www.sqlite.org/ | SQLite] for on-disk
storage. The SQLite implementation is contained in three source
code files that do not participate in the preprocessing steps.
These three files that implement SQLite are:
4. sqlite3.c
5. sqlite3.h
6. shell.c
The sqlite3.c and sqlite3.h source files are byte-for-byte copies of a
All three SQLite source files are byte-for-byte copies of files by
the same name in the
standard [http://www.sqlite.org/amalgamation.html | amalgamation].
The shell.c source file is code for the SQLite
[http://www.sqlite.org/sqlite.html | command-line shell] that is used
to help implement the [/help/sqlite3 | fossil sql] command. The
The sqlite3.c file implements the database engine. The shell.c file
implements the command-line shell, which is accessed in fossil using
the [/help?cmd=sqlite3 | fossil sql] command.
shell.c source file is also a byte-for-byte copy of the
shell.c file from the SQLite release.
The SQLite shell.c file uses the [https://github.com/antirez/linenoise |
The shell.c command-line shell uses the [https://github.com/antirez/linenoise |
linenoise] library to implement line editing. linenoise comprises two
source files which were copied from the upstream repository with only
very minor portability edits:
7. linenoise.c
8. linenoise.h
The TH1 script engine is implemented using files:
9. th.c
10. th.h
These two files are imports like the SQLite source files,
and so are not preprocessed.
The proprocessing steps are omitted for all of these imported
files.
The VERSION.h header file is generated from other information sources
using a small program called:
11. mkversion.c
11. [/file/src/mkversion.c | mkversion.c]
The builtin_data.h header file contains the definitions of C-language
byte-array constants that contain various resources such as scripts and
images. The builtin_data.h header file is generate from the original
resource files using a small program called:
12 mkbuiltin.c
12 [/file/src/mkbuiltin.c | mkbuildin.c]
Examples of built-in resources include the [/file/src/diff.tcl | diff.tcl]
script used to implement the --tk option to [/help?cmd=diff| fossil diff],
the [/file/src/markdown.md | markdown documentation], and the various
CSS scripts, headers, and footers used to implement built-in skins. New
resources files are added to the "extra_files" variable in
[/file/src/makemake.tcl | makemake.tcl].
The src/ subdirectory also contains documentation about the
makeheaders preprocessor program:
13. [../src/makeheaders.html | makeheaders.html]
Click on the link to read this documentation. In addition there is
a [http://www.tcl-lang.org/ | Tcl] script used to build the various makefiles:
14. makemake.tcl
Running this Tcl script will automatically regenerate all makefiles.
In order to add a new source file to the Fossil implementation, simply
edit makemake.tcl to add the new filename, then rerun the script, and
all of the makefiles for all targets will be rebuild.
There is an option code verification step implemented using
15. [/file/src/codecheck1.c | codecheck1.c]
This file implements a small utility program ("codecheck1")
that scans other Fossil source files looking for errors in printf-style
format strings.
The codecheck1 utility detects missing or surplus arguments on
printf-like functions and dangerous uses of "%s" that might
permit SQL injection or cross-site scripting attacks. This code
check step is run automatically on each build of Fossil, and can
also be run separately by typing "make codecheck". Note that the
built-in printf format checking of GCC does not function for Fossil
since Fossil implements its own printf (in the
[/file/src/printf.c | printf.c] source file) that includes special
features and formatting letters that are useful to Fossil. The
codecheck1 utility can be seen as an enhanced application-specific
replacement for the GCC printf format checker.
Finally, there is one of the makefiles generated by makemake.tcl:
15. main.mk
16. main.mk
The main.mk makefile is invoked from the Makefile in the top-level
directory. The main.mk is generated by makemake.tcl and should not
be hand edited. Other makefiles generated by makemake.tcl are in
other subdirectories (currently all in the win/ subdirectory).
All the other files in the src/ subdirectory (79 files at the time of
|