Debian Codegraph @

embedded/www/files/critcl_application.html

raw
1 <!DOCTYPE html><html><head>
2 <meta charset="UTF-8">
3 <meta name="viewport" content="width=device-width, initial-scale=1">
4 <title>critcl_application - C Runtime In Tcl (CriTcl)</title>
5 <style type="text/css"><!--
6 HTML {
7 background: #FFFFFF;
8 color: black;
9 }
10 BODY {
11 background: #FFFFFF;
12 color: black;
13 }
14 DIV.doctools {
15 margin-left: 10%;
16 margin-right: 10%;
17 }
18 DIV.doctools H1,DIV.doctools H2 {
19 margin-left: -5%;
20 }
21 H1, H2, H3, H4 {
22 margin-top: 1em;
23 font-family: sans-serif;
24 font-size: large;
25 color: #005A9C;
26 background: transparent;
27 text-align: left;
28 }
29 H1.doctools_title {
30 text-align: center;
31 }
32 UL,OL {
33 margin-right: 0em;
34 margin-top: 3pt;
35 margin-bottom: 3pt;
36 }
37 UL LI {
38 list-style: disc;
39 }
40 OL LI {
41 list-style: decimal;
42 }
43 DT {
44 padding-top: 1ex;
45 }
46 UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL {
47 font: normal 12pt/14pt sans-serif;
48 list-style: none;
49 }
50 LI.doctools_section, LI.doctools_subsection {
51 list-style: none;
52 margin-left: 0em;
53 text-indent: 0em;
54 padding: 0em;
55 }
56 PRE {
57 display: block;
58 font-family: monospace;
59 white-space: pre;
60 margin: 0%;
61 padding-top: 0.5ex;
62 padding-bottom: 0.5ex;
63 padding-left: 1ex;
64 padding-right: 1ex;
65 width: 100%;
66 }
67 PRE.doctools_example {
68 color: black;
69 background: #f5dcb3;
70 border: 1px solid black;
71 }
72 UL.doctools_requirements LI, UL.doctools_syntax LI {
73 list-style: none;
74 margin-left: 0em;
75 text-indent: 0em;
76 padding: 0em;
77 }
78 DIV.doctools_synopsis {
79 color: black;
80 background: #80ffff;
81 border: 1px solid black;
82 font-family: serif;
83 margin-top: 1em;
84 margin-bottom: 1em;
85 }
86 UL.doctools_syntax {
87 margin-top: 1em;
88 border-top: 1px solid black;
89 }
90 UL.doctools_requirements {
91 margin-bottom: 1em;
92 border-bottom: 1px solid black;
93 }
94 --></style>
95 </head>
96 <!-- Generated from file 'critcl_application.man' by tcllib/doctools with format 'html'
97 -->
98 <!-- Copyright &amp;copy; Jean-Claude Wippler -- Copyright &amp;copy; Steve Landers -- Copyright &amp;copy; 2011-2024 Andreas Kupries
99 -->
100 <!-- critcl_application.n
101 -->
102 <body><hr> [
103 <a href="../toc.html">Table Of Contents</a>
104 &#124; <a href="../index.html">Keyword Index</a>
105 ] <hr>
106 <div class="doctools">
107 <h1 class="doctools_title">critcl_application(n) 3.3.1 doc &quot;C Runtime In Tcl (CriTcl)&quot;</h1>
108 <div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
109 <p>critcl_application - CriTcl Application Reference</p>
110 </div>
111 <div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
112 <ul class="doctools_toc">
113 <li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
114 <li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
115 <li class="doctools_section"><a href="#section1">Description</a></li>
116 <li class="doctools_section"><a href="#section2">Application Options</a></li>
117 <li class="doctools_section"><a href="#section3">Package Structure</a></li>
118 <li class="doctools_section"><a href="#section4">Authors</a></li>
119 <li class="doctools_section"><a href="#section5">Bugs, Ideas, Feedback</a></li>
120 <li class="doctools_section"><a href="#keywords">Keywords</a></li>
121 <li class="doctools_section"><a href="#category">Category</a></li>
122 <li class="doctools_section"><a href="#copyright">Copyright</a></li>
123 </ul>
124 </div>
125 <div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
126 <div class="doctools_synopsis">
127 <ul class="doctools_syntax">
128 <li><a href="#1"><b class="cmd"><a href="critcl.html">critcl</a></b> <span class="opt">?<i class="arg">option</i>...?</span> <span class="opt">?<i class="arg">file</i>...?</span></a></li>
129 </ul>
130 </div>
131 </div>
132 <div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2>
133 <p>Be welcome to the <i class="term">C Runtime In Tcl</i> (short: <i class="term"><a href="critcl.html">CriTcl</a></i>), a system for embedding and using C
134 code from within <a href="http://core.tcl-lang.org/tcl">Tcl</a> scripts.</p>
135 <p>This document is the reference manpage for the <b class="cmd"><a href="critcl.html">critcl</a></b> command.
136 Its intended audience are people having to build packages using
137 <b class="package"><a href="critcl.html">critcl</a></b> for deployment. Writers of packages with embedded C
138 code can ignore this document.
139 If you are in need of an overview of the whole system instead, please
140 go and read the <i class="term"><a href="critcl.html">Introduction To CriTcl</a></i>.</p>
141 <p>This application resides in the Application Layer of CriTcl.</p>
142 <p><img alt="arch_application" src="../image/arch_application.png"></p>
143 <p>.
144 The application supports the following general command line:</p>
145 <dl class="doctools_definitions">
146 <dt><a name="1"><b class="cmd"><a href="critcl.html">critcl</a></b> <span class="opt">?<i class="arg">option</i>...?</span> <span class="opt">?<i class="arg">file</i>...?</span></a></dt>
147 <dd><p>The exact set of options supported, their meaning, and interaction is
148 detailed in section <span class="sectref"><a href="#section2">Application Options</a></span> below.
149 For a larger set of examples please see section &quot;Building CriTcl Packages&quot;
150 in the document about <i class="term">Using CriTcl</i>.</p></dd>
151 </dl>
152 </div>
153 <div id="section2" class="doctools_section"><h2><a name="section2">Application Options</a></h2>
154 <p>The following options are understood:</p>
155 <dl class="doctools_options">
156 <dt><b class="option">-v</b></dt>
157 <dd></dd>
158 <dt><b class="option">--version</b></dt>
159 <dd><p>Print the version to <b class="const">stdout</b> and exit.</p></dd>
160 <dt><b class="option">-I</b> path</dt>
161 <dd><p>Arranges for the compiler to search <i class="arg">path</i> for headers.
162 Uses of this option are cumulative.</p>
163 <p>Ignored when generating a TEA package
164 (see option <b class="option">-tea</b> below).</p></dd>
165 <dt><b class="option">-L</b> path</dt>
166 <dd><p>Arranges for the linker to search <i class="arg">path</i>.
167 Uses of this option are cumulative.</p>
168 <p>Ignored when generating a TEA package
169 (see option <b class="option">-tea</b> below).</p></dd>
170 <dt><b class="option">-cache</b> path</dt>
171 <dd><p>Sets <i class="arg">path</i> as the directory to use as the result cache. The default is
172 &quot;<b class="file">~/.critcl/&lt;platform&gt;</b>&quot;, or &quot;<b class="file">~/.critcl/&lt;pid&gt;.&lt;epoch&gt;</b>&quot; when generating
173 a package. See option <b class="option">-pkg</b>, below.</p>
174 <p>Ignored when generating a TEA package
175 (see option <b class="option">-tea</b> below).</p></dd>
176 <dt><b class="option">-clean</b></dt>
177 <dd><p>Arranges for all files and directories in the result cache to be deleted before
178 compilation begins.</p>
179 <p>Ignored when generating a package because this mode starts out with a
180 unique and empty result cache. See option <b class="option">-pkg</b>, below.</p>
181 <p>Ignored when generating a TEA package
182 (see option <b class="option">-tea</b> below).</p></dd>
183 <dt><b class="option">-config</b> path</dt>
184 <dd><p>Provides a custom configuration file. By default a configuration included in
185 the system core is used.
186 When specified multiple times the last value is used.</p>
187 <p>Ignored when generating a TEA package
188 (see option <b class="option">-tea</b> below).</p></dd>
189 <dt><b class="option">-debug</b> mode</dt>
190 <dd><p>Activates one of the following debugging modes:</p>
191 <dl class="doctools_definitions">
192 <dt><b class="const">memory</b></dt>
193 <dd><p>Track and report memory allocations made by the Tcl core.</p></dd>
194 <dt><b class="const">symbols</b></dt>
195 <dd><p>Compile all &quot;<b class="file">.c</b>&quot; files with debugging symbols.</p></dd>
196 <dt><b class="const">all</b></dt>
197 <dd><p>Both <b class="const">memory</b> and <b class="const">symbols</b>.</p></dd>
198 </dl>
199 <p>Ignored when generating a TEA package
200 (see option <b class="option">-tea</b> below).
201 Uses of this option are cumulative.</p></dd>
202 <dt><b class="option">-disable</b> name</dt>
203 <dd><p>Sets the value of the custom build configuration option
204 <i class="arg">name</i> to <b class="const">false</b>. It is equivalent to &quot;-with-<i class="arg">name</i> 0&quot;.</p>
205 <p>Validated only if one of the input files for the <i class="term">CriTcl script</i>
206 actually defines and uses a custom build configuration option with that
207 <i class="arg">name</i>.</p>
208 <p>Ignored when generating a TEA package
209 (see option <b class="option">-tea</b> below).</p></dd>
210 <dt><b class="option">-enable</b> name</dt>
211 <dd><p>Sets the value of the custom build configuration option
212 <i class="arg">name</i> to <b class="const">true</b>. It is equivalent to &quot;-with-<i class="arg">name</i> 1&quot;.</p>
213 <p>Validated only if one of the input files for the <i class="term">CriTcl script</i>
214 actually defines and uses a custom build configuration option with that
215 <i class="arg">name</i>.</p>
216 <p>Ignored when generating a TEA package
217 (see option <b class="option">-tea</b> below).</p></dd>
218 <dt><b class="option">-force</b></dt>
219 <dd><p>Forces compilation even if a shared library for the file already exists.
220 Unlike cleaning the cache, this is lazy in the destruction of files and only
221 affects relevant files.</p>
222 <p>Ignored when generating a package (see option <b class="option">-pkg</b>, below),
223 which starts out with a unique and empty result cache.</p>
224 <p>Ignored when generating a TEA package
225 (see option <b class="option">-tea</b> below).</p></dd>
226 <dt><b class="option">-help</b></dt>
227 <dd><p>Prints a short description of command line syntax and options and then exits
228 the application.</p></dd>
229 <dt><b class="option">-keep</b></dt>
230 <dd><p>Causes the system to cache compiled &quot;<b class="file">.c</b>&quot; files.
231 Also prevents the deletion of the unique result cache used by the run when
232 generating a package (see option <b class="option">-pkg</b> below),
233 Intended for debugging of <b class="cmd"><a href="critcl.html">critcl</a></b> itself, where it may be necessary to
234 inspect the generated C code.</p>
235 <p>Ignored when generating a TEA package
236 (see option <b class="option">-tea</b> below).</p></dd>
237 <dt><b class="option">-libdir</b> directory</dt>
238 <dd><p>Adds <i class="arg">directory</i> to the list of directories the linker searches for
239 libraries in (like <b class="option">-L</b>). With <b class="option">-pkg</b>, generated packages are
240 saved in <i class="arg">directory</i>.
241 When specified multiple times the last value is used.
242 The default is &quot;<b class="file">lib</b>&quot;, resolved relative to the current working directory.</p></dd>
243 <dt><b class="option">-includedir</b> directory</dt>
244 <dd><p>Adds <i class="arg">directory</i> to the list of directories the compiler searches for
245 headers in. With <b class="option">-pkg</b>, generated header files are saved in
246 <i class="arg">directory</i>.
247 Uses of this option are cumulative.
248 The last value is used as the destination for generated header files.
249 The default is the relative directory &quot;<b class="file">include</b>&quot;, resolved relative to the
250 current working directory.</p>
251 <p>Ignored when generating a TEA package
252 (see option <b class="option">-tea</b> below).</p></dd>
253 <dt><b class="option">-pkg</b></dt>
254 <dd><p>Generates a package from the <i class="term">CriTcl script</i> files. Input files are
255 processed first as usual, but are then bundled into a single library, with
256 additional generated files to form the library into a standard Tcl package.</p>
257 <p>generation. If both options, i.e. <b class="option">-pkg</b> and <b class="option">-tea</b> are
258 specified the last one specified wins.</p>
259 <p>Options <b class="option">-clean</b> and <b class="option">-force</b> are ignored. <b class="option">-libdir</b> is
260 relevant in both this and <b class="option">-tea</b> mode.</p>
261 <p>The basename of the first file is the name of the package to generate. If
262 its file extension indicates a shared library (&quot;<b class="file">.so</b>&quot;, &quot;<b class="file">.sl</b>&quot;,
263 &quot;<b class="file">.dylib</b>&quot;, and &quot;<b class="file">.dll</b>&quot;) it is also removed from the set of input
264 files. Each <i class="term">CriTcl script</i> file is kept as part of the input. A single
265 file without a suffix is assumed to be a <i class="term">CriTcl script</i>. A file without
266 a suffix, but other input files following is treated like the name of a
267 shared library proper, and removed from the set of input files.</p>
268 <p>Examples:</p>
269 <pre class="doctools_example">
270 ... -pkg ... foo
271 =&gt; Package name is: foo
272 =&gt; Input file is: foo.tcl
273 </pre>
274 <pre class="doctools_example">
275 ... -pkg ... foo bar.tcl
276 =&gt; Package name is: foo
277 =&gt; Input file is: bar.tcl
278 </pre>
279 <pre class="doctools_example">
280 ... -pkg ... foo.tcl
281 =&gt; Package name is: foo
282 =&gt; Input file is: foo.tcl
283 </pre>
284 <pre class="doctools_example">
285 ... -pkg ... foo.so bar.tcl
286 =&gt; Package name is: foo
287 =&gt; Input file is: bar.tcl
288 </pre>
289 </dd>
290 <dt><b class="option">-show</b></dt>
291 <dd><p>Prints the configuration of the chosen target to <b class="const">stdout</b> and then exits.
292 Set <b class="option">-target</b>, below.</p></dd>
293 <dt><b class="option">-showall</b></dt>
294 <dd><p>Prints the whole chosen configuration file to <b class="const">stdout</b> and then exits.
295 See <b class="option">-config</b>, above.</p></dd>
296 <dt><b class="option">-target</b> name</dt>
297 <dd><p>Overrides the default choice of build target.
298 Only the last occurrence of this option is used.
299 The named target must exist in the chosen configuration file.
300 Use <b class="option">-targets</b> (see below) to get a list of the
301 acceptable targets.
302 Use <b class="option">-config</b> to select the configuration file.</p>
303 <p>Ignored when generating a TEA package
304 (see option <b class="option">-tea</b> below).</p></dd>
305 <dt><b class="option">-targets</b></dt>
306 <dd><p>Prints the list of all known targets from the chosen configuration file to
307 <b class="const">stdout</b> and then exits.
308 Use <b class="option">-config</b> to select the configuration file.</p></dd>
309 <dt><b class="option">-tea</b></dt>
310 <dd><p>Like <b class="option">-pkg</b>, except no binaries are generated. Creates a directory
311 hierarchy containing the <i class="term">CriTcl script</i>, its companion files, and a
312 TEA-conformant build system with most of the needed support code, including
313 copies of the critcl packages.</p>
314 <p>If both <b class="option">-pkg</b> and <b class="option">-tea</b> are specified the last occurrence wins.</p>
315 <p><b class="option">-I</b>, <b class="option">-L</b>, <b class="option">-clean</b>,
316 <b class="option">-force</b>, <b class="option">-cache</b>, <b class="option">-includedir</b>, <b class="option">-enable</b>,
317 <b class="option">-disable</b>, and <b class="option">-with-<b class="variable">FOO</b></b> are
318 ignored. In contrast, the option <b class="option">-libdir</b> is relevant in both
319 this and <b class="option">-pkg</b> mode.</p>
320 <p>The basename of the first file is the name of the package to generate. If
321 its file extension indicates a shared library (&quot;<b class="file">.so</b>&quot;, &quot;<b class="file">.sl</b>&quot;,
322 &quot;<b class="file">.dylib</b>&quot;, and &quot;<b class="file">.dll</b>&quot;) it is also removed from the set of input
323 files. Each <i class="term">CriTcl script</i> file is kept as part of the input. A single
324 file without a suffix is assumed to be a <i class="term">CriTcl script</i>. A file without
325 a suffix, but other input files following is treated like the name of a
326 shared library proper, and removed from the set of input files.</p>
327 <p>Examples:</p>
328 <pre class="doctools_example">
329 ... -tea ... foo
330 =&gt; Package name is: foo
331 =&gt; Input file is: foo.tcl
332 </pre>
333 <pre class="doctools_example">
334 ... -tea ... foo bar.tcl
335 =&gt; Package name is: foo
336 =&gt; Input file is: bar.tcl
337 </pre>
338 <pre class="doctools_example">
339 ... -tea ... foo.tcl
340 =&gt; Package name is: foo
341 =&gt; Input file is: foo.tcl
342 </pre>
343 <pre class="doctools_example">
344 ... -tea ... foo.so bar.tcl
345 =&gt; Package name is: foo
346 =&gt; Input file is: bar.tcl
347 </pre>
348 </dd>
349 <dt><b class="option">-with-<b class="variable">name</b></b> value</dt>
350 <dd><p>This option sets the value of the custom build configuration option
351 <i class="arg">name</i> to <i class="arg">value</i>.</p>
352 <p>The information is validated only if one of the &quot;<b class="file">.critcl</b>&quot;
353 input files actually defines and uses a custom build configuration
354 option with that <i class="arg">name</i>.</p>
355 <p>Ignored when generating a TEA package
356 (see option <b class="option">-tea</b> below).</p></dd>
357 </dl>
358 </div>
359 <div id="section3" class="doctools_section"><h2><a name="section3">Package Structure</a></h2>
360 <p>Packages generated by critcl have the following basic structure:</p>
361 <pre class="doctools_example">
362 &lt;TOP&gt;
363 +- pkgIndex.tcl
364 +- critcl-rt.tcl
365 +- license.terms (optional)
366 |
367 +- tcl (optional)
368 | +- &lt;tsources files&gt;
369 |
370 +- &lt;platform&gt;
371 +- &lt;shared library&gt;
372 </pre>
373 <p><em>Notes</em></p>
374 <ol class="doctools_enumerated">
375 <li><p>The file &quot;<b class="file">pkgIndex.tcl</b>&quot; is the standard package index file
376 expected by Tcl's package management. It is sourced during a search
377 for packages, and declares the package to Tcl with its files, and how
378 to handle them.</p></li>
379 <li><p>The file &quot;<b class="file">critcl-rt.tcl</b>&quot; is a helper file containing the
380 common code used by &quot;<b class="file">pkgIndex.tcl</b>&quot; to perform its tasks.</p></li>
381 <li><p>The file &quot;<b class="file">license.terms</b>&quot; is optional and appears only if
382 the &quot;<b class="file">.critcl</b>&quot; file the package is generated from used the command
383 <b class="cmd">critcl::license</b> to declare package author and license.</p></li>
384 <li><p>All files declared with the command <b class="cmd">critcl::tsources</b> are
385 put into the sub-directory &quot;<b class="file">tcl</b>&quot;.</p></li>
386 <li><p>The shared library generated by critcl is put into a
387 platform-specific sub-directory.</p></li>
388 </ol>
389 <p>The whole structure, and especially the last point, enable us
390 to later merge the results (for the same package, and version) for
391 multiple target platforms into a single directory structure without
392 conflict, by simply copying the top directories over each other. The
393 only files which can conflict are in the &lt;TOP&gt; and &quot;<b class="file">tcl</b>&quot;
394 directories, and for these we know that they are identical across
395 targets. The result of such a merge would look like:</p>
396 <pre class="doctools_example">
397 &lt;TOP&gt;
398 +- pkgIndex.tcl
399 +- critcl-rt.tcl
400 +- license.terms (optional)
401 |
402 +- tcl (optional)
403 | +- &lt;tsources files&gt;
404 |
405 +- &lt;platform1&gt;
406 | +- &lt;shared library1&gt;
407 +- &lt;platform2&gt;
408 | +- &lt;shared library2&gt;
409 ...
410 +- &lt;platformN&gt;
411 +- &lt;shared libraryN&gt;
412 </pre>
413 </div>
414 <div id="section4" class="doctools_section"><h2><a name="section4">Authors</a></h2>
415 <p>Jean Claude Wippler, Steve Landers, Andreas Kupries</p>
416 </div>
417 <div id="section5" class="doctools_section"><h2><a name="section5">Bugs, Ideas, Feedback</a></h2>
418 <p>This document, and the package it describes, will undoubtedly contain
419 bugs and other problems.
420 Please report them at <a href="https://github.com/andreas-kupries/critcl/issues">https://github.com/andreas-kupries/critcl/issues</a>.
421 Ideas for enhancements you may have for either package, application,
422 and/or the documentation are also very welcome and should be reported
423 at <a href="https://github.com/andreas-kupries/critcl/issues">https://github.com/andreas-kupries/critcl/issues</a> as well.</p>
424 </div>
425 <div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2>
426 <p><a href="../index.html#c_code">C code</a>, <a href="../index.html#embedded_c_code">Embedded C Code</a>, <a href="../index.html#calling_c_code_from_tcl">calling C code from Tcl</a>, <a href="../index.html#code_generator">code generator</a>, <a href="../index.html#compile_run">compile &amp; run</a>, <a href="../index.html#compiler">compiler</a>, <a href="../index.html#dynamic_code_generation">dynamic code generation</a>, <a href="../index.html#dynamic_compilation">dynamic compilation</a>, <a href="../index.html#generate_package">generate package</a>, <a href="../index.html#linker">linker</a>, <a href="../index.html#on_demand_compilation">on demand compilation</a>, <a href="../index.html#on_the_fly_compilation">on-the-fly compilation</a></p>
427 </div>
428 <div id="category" class="doctools_section"><h2><a name="category">Category</a></h2>
429 <p>Glueing/Embedded C code</p>
430 </div>
431 <div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2>
432 <p>Copyright &copy; Jean-Claude Wippler<br>
433 Copyright &copy; Steve Landers<br>
434 Copyright &copy; 2011-2024 Andreas Kupries</p>
435 </div>
436 </div></body></html>