| | @@ -24,32 +24,31 @@ |
| 24 | 24 | |
| 25 | 25 | Each preprocessor program is a separate C program implemented in |
| 26 | 26 | a single file of C source code. The three preprocessor programs |
| 27 | 27 | are: |
| 28 | 28 | |
| 29 | | - 1. mkindex.c |
| 30 | | - 2. translate.c |
| 31 | | - 3. makeheaders.c |
| 29 | + 1. [/file/src/mkindex.c | mkindex.c] |
| 30 | + 2. [/file/src/translate.c | translate.c] |
| 31 | + 3. [/file/src/makeheaders.c | makeheaders.c] |
| 32 | 32 | |
| 33 | | -Fossil makes use of [http://www.sqlite.org/ | SQLite] for on-disk |
| 33 | +Fossil uses [http://www.sqlite.org/ | SQLite] for on-disk |
| 34 | 34 | storage. The SQLite implementation is contained in three source |
| 35 | 35 | code files that do not participate in the preprocessing steps. |
| 36 | 36 | These three files that implement SQLite are: |
| 37 | 37 | |
| 38 | 38 | 4. sqlite3.c |
| 39 | 39 | 5. sqlite3.h |
| 40 | 40 | 6. shell.c |
| 41 | 41 | |
| 42 | | -The sqlite3.c and sqlite3.h source files are byte-for-byte copies of a |
| 42 | +All three SQLite source files are byte-for-byte copies of files by |
| 43 | +the same name in the |
| 43 | 44 | standard [http://www.sqlite.org/amalgamation.html | amalgamation]. |
| 44 | | -The shell.c source file is code for the SQLite |
| 45 | | -[http://www.sqlite.org/sqlite.html | command-line shell] that is used |
| 46 | | -to help implement the [/help/sqlite3 | fossil sql] command. The |
| 47 | | -shell.c source file is also a byte-for-byte copy of the |
| 48 | | -shell.c file from the SQLite release. |
| 45 | +The sqlite3.c file implements the database engine. The shell.c file |
| 46 | +implements the command-line shell, which is accessed in fossil using |
| 47 | +the [/help?cmd=sqlite3 | fossil sql] command. |
| 49 | 48 | |
| 50 | | -The SQLite shell.c file uses the [https://github.com/antirez/linenoise | |
| 49 | +The shell.c command-line shell uses the [https://github.com/antirez/linenoise | |
| 51 | 50 | linenoise] library to implement line editing. linenoise comprises two |
| 52 | 51 | source files which were copied from the upstream repository with only |
| 53 | 52 | very minor portability edits: |
| 54 | 53 | |
| 55 | 54 | 7. linenoise.c |
| | @@ -58,24 +57,31 @@ |
| 58 | 57 | The TH1 script engine is implemented using files: |
| 59 | 58 | |
| 60 | 59 | 9. th.c |
| 61 | 60 | 10. th.h |
| 62 | 61 | |
| 63 | | -These two files are imports like the SQLite source files, |
| 64 | | -and so are not preprocessed. |
| 62 | +The proprocessing steps are omitted for all of these imported |
| 63 | +files. |
| 65 | 64 | |
| 66 | 65 | The VERSION.h header file is generated from other information sources |
| 67 | 66 | using a small program called: |
| 68 | 67 | |
| 69 | | - 11. mkversion.c |
| 68 | + 11. [/file/src/mkversion.c | mkversion.c] |
| 70 | 69 | |
| 71 | 70 | The builtin_data.h header file contains the definitions of C-language |
| 72 | 71 | byte-array constants that contain various resources such as scripts and |
| 73 | 72 | images. The builtin_data.h header file is generate from the original |
| 74 | 73 | resource files using a small program called: |
| 75 | 74 | |
| 76 | | - 12 mkbuiltin.c |
| 75 | + 12 [/file/src/mkbuiltin.c | mkbuildin.c] |
| 76 | + |
| 77 | +Examples of built-in resources include the [/file/src/diff.tcl | diff.tcl] |
| 78 | +script used to implement the --tk option to [/help?cmd=diff| fossil diff], |
| 79 | +the [/file/src/markdown.md | markdown documentation], and the various |
| 80 | +CSS scripts, headers, and footers used to implement built-in skins. New |
| 81 | +resources files are added to the "extra_files" variable in |
| 82 | +[/file/src/makemake.tcl | makemake.tcl]. |
| 77 | 83 | |
| 78 | 84 | The src/ subdirectory also contains documentation about the |
| 79 | 85 | makeheaders preprocessor program: |
| 80 | 86 | |
| 81 | 87 | 13. [../src/makeheaders.html | makeheaders.html] |
| | @@ -87,14 +93,33 @@ |
| 87 | 93 | |
| 88 | 94 | Running this Tcl script will automatically regenerate all makefiles. |
| 89 | 95 | In order to add a new source file to the Fossil implementation, simply |
| 90 | 96 | edit makemake.tcl to add the new filename, then rerun the script, and |
| 91 | 97 | all of the makefiles for all targets will be rebuild. |
| 98 | + |
| 99 | +There is an option code verification step implemented using |
| 100 | + |
| 101 | + 15. [/file/src/codecheck1.c | codecheck1.c] |
| 102 | + |
| 103 | +This file implements a small utility program ("codecheck1") |
| 104 | +that scans other Fossil source files looking for errors in printf-style |
| 105 | +format strings. |
| 106 | +The codecheck1 utility detects missing or surplus arguments on |
| 107 | +printf-like functions and dangerous uses of "%s" that might |
| 108 | +permit SQL injection or cross-site scripting attacks. This code |
| 109 | +check step is run automatically on each build of Fossil, and can |
| 110 | +also be run separately by typing "make codecheck". Note that the |
| 111 | +built-in printf format checking of GCC does not function for Fossil |
| 112 | +since Fossil implements its own printf (in the |
| 113 | +[/file/src/printf.c | printf.c] source file) that includes special |
| 114 | +features and formatting letters that are useful to Fossil. The |
| 115 | +codecheck1 utility can be seen as an enhanced application-specific |
| 116 | +replacement for the GCC printf format checker. |
| 92 | 117 | |
| 93 | 118 | Finally, there is one of the makefiles generated by makemake.tcl: |
| 94 | 119 | |
| 95 | | - 15. main.mk |
| 120 | + 16. main.mk |
| 96 | 121 | |
| 97 | 122 | The main.mk makefile is invoked from the Makefile in the top-level |
| 98 | 123 | directory. The main.mk is generated by makemake.tcl and should not |
| 99 | 124 | be hand edited. Other makefiles generated by makemake.tcl are in |
| 100 | 125 | other subdirectories (currently all in the win/ subdirectory). |
| 101 | 126 | |