48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
+
-
+
+
|
source tree. Suppose one wants to add a new source code file named
"xyzzy.c". The first step is to add this file to the various makefiles.
Do so by editing the file tools/makemake.tcl and adding "xyzzy" (without
the final ".c") to the list of source modules at the top of that script.
Save the result and then run the makemake.tcl script using a TCL
interpreter. The command to run the makemake.tcl script is:
<verbatim>
<b>tclsh makemake.tcl</b>
tclsh makemake.tcl
</verbatim>
The working directory must be src/ when the command above is run.
Note that TCL is not normally required to build Fossil, but
it is required for this step. If you do not have a TCL interpreter on
your system already, they are easy to install. A popular choice is the
[http://www.activestate.com/activetcl|Active Tcl] installation from
ActiveState.
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
+
-
+
+
|
Fossil repository and then [/help/commit|commit] your changes!
<h2 id="newcmd">4.0 Creating A New Command</h2>
By "commands" we mean the keywords that follow "fossil" when invoking
Fossil from the command-line. So, for example, in
<verbatim>
<b>fossil diff xyzzy.c</b>
fossil diff xyzzy.c
</verbatim>
The "command" is "diff". Commands may optionally be followed by
arguments and/or options. To create new commands in Fossil, add code
(either to an existing source file, or to a new source file created as
described above) according to the following template:
<verbatim>
|
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
+
-
-
-
+
+
+
+
|
"test" then the command will be considered experimental and will only
show up when the --test option is used with [/help/help|fossil help].
The example above is a fully functioning Fossil command. You can add
the text shown to an existing Fossil source file, recompiling then test
it out by typing:
<verbatim>
<b>./fossil xyzzy<br>
./fossil help xyzzy<br>
./fossil xyzzy --help</b>
./fossil xyzzy
./fossil help xyzzy
./fossil xyzzy --help
</verbatim>
The name of the C function that implements the command can be anything
you like (as long as it does not collide with some other symbol in the
Fossil code) but it is traditional to name the function
"<i>commandname</i><b>_cmd</b>", as is done in the example.
You could also use "printf()" instead of "fossil_print()" to generate
|