| 1 |
<!DOCTYPE html><html><head> |
| 2 |
<meta charset="UTF-8"> |
| 3 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 4 |
<title>critcl_devguide - 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_devguide.man' by tcllib/doctools with format 'html' |
| 97 |
--> |
| 98 |
<!-- Copyright &copy; Jean-Claude Wippler -- Copyright &copy; Steve Landers -- Copyright &copy; 2011-2024 Andreas Kupries |
| 99 |
--> |
| 100 |
<!-- critcl_devguide.n |
| 101 |
--> |
| 102 |
<body><hr> [ |
| 103 |
<a href="../toc.html">Table Of Contents</a> |
| 104 |
| <a href="../index.html">Keyword Index</a> |
| 105 |
] <hr> |
| 106 |
<div class="doctools"> |
| 107 |
<h1 class="doctools_title">critcl_devguide(n) 3.3.1 doc "C Runtime In Tcl (CriTcl)"</h1> |
| 108 |
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2> |
| 109 |
<p>critcl_devguide - Guide To The CriTcl Internals</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="#section1">Description</a></li> |
| 115 |
<li class="doctools_section"><a href="#section2">Audience</a></li> |
| 116 |
<li class="doctools_section"><a href="#section3">Playing with CriTcl</a></li> |
| 117 |
<li class="doctools_section"><a href="#section4">Developing for CriTcl</a> |
| 118 |
<ul> |
| 119 |
<li class="doctools_subsection"><a href="#subsection1">Architecture & Concepts</a></li> |
| 120 |
<li class="doctools_subsection"><a href="#subsection2">Requirements</a></li> |
| 121 |
<li class="doctools_subsection"><a href="#subsection3">Directory structure</a></li> |
| 122 |
</ul> |
| 123 |
</li> |
| 124 |
<li class="doctools_section"><a href="#section5">Authors</a></li> |
| 125 |
<li class="doctools_section"><a href="#section6">Bugs, Ideas, Feedback</a></li> |
| 126 |
<li class="doctools_section"><a href="#keywords">Keywords</a></li> |
| 127 |
<li class="doctools_section"><a href="#category">Category</a></li> |
| 128 |
<li class="doctools_section"><a href="#copyright">Copyright</a></li> |
| 129 |
</ul> |
| 130 |
</div> |
| 131 |
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2> |
| 132 |
<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 |
| 133 |
code from within <a href="http://core.tcl-lang.org/tcl">Tcl</a> scripts.</p> |
| 134 |
</div> |
| 135 |
<div id="section2" class="doctools_section"><h2><a name="section2">Audience</a></h2> |
| 136 |
<p>This document is a guide for developers working on CriTcl, i.e. maintainers fixing |
| 137 |
bugs, extending the package's functionality, etc.</p> |
| 138 |
<p>Please read</p> |
| 139 |
<ol class="doctools_enumerated"> |
| 140 |
<li><p><i class="term">CriTcl - License</i>,</p></li> |
| 141 |
<li><p><i class="term">CriTcl - How To Get The Sources</i>, and</p></li> |
| 142 |
<li><p><i class="term">CriTcl - The Installer's Guide</i></p></li> |
| 143 |
</ol> |
| 144 |
<p>first, if that was not done already.</p> |
| 145 |
<p>Here we assume that the sources are already available in a directory of the readers |
| 146 |
choice, and that the reader not only know how to build and install them, but also has all |
| 147 |
the necessary requisites to actually do so. The guide to the sources in particular also |
| 148 |
explains which source code management system is used, where to find it, how to set it up, |
| 149 |
etc.</p> |
| 150 |
</div> |
| 151 |
<div id="section3" class="doctools_section"><h2><a name="section3">Playing with CriTcl</a></h2> |
| 152 |
<p><em>Note</em> that the sources of CriTcl, should the reader have gotten them, also |
| 153 |
contain several examples show-casing various aspects of the system. These demonstration |
| 154 |
packages can all be found in the sub-directory "<b class="file">examples/</b>" of the sources.</p> |
| 155 |
<p>Lots of smaller examples can be found in the document |
| 156 |
<i class="term">Using CriTcl</i>, an introduction to CriTcl by way of a of |
| 157 |
examples. These focus more on specific critcl commands than the |
| 158 |
overall picture shown by the large examples mentioned in the previous |
| 159 |
paragraph.</p> |
| 160 |
</div> |
| 161 |
<div id="section4" class="doctools_section"><h2><a name="section4">Developing for CriTcl</a></h2> |
| 162 |
<div id="subsection1" class="doctools_subsection"><h3><a name="subsection1">Architecture & Concepts</a></h3> |
| 163 |
<p>The system consists of two main layers, as seen in the figure below, |
| 164 |
plus a support layer containing general packages the system uses during |
| 165 |
operation.</p> |
| 166 |
<p><img alt="architecture" src="../image/architecture.png"></p> |
| 167 |
<ol class="doctools_enumerated"> |
| 168 |
<li><p>At the top we have an application built on top of the core packages, |
| 169 |
providing command line access to the second and third usage modes, |
| 170 |
i.e. <i class="term"><a href="../index.html#generate_package">Generate Package</a></i> and <i class="term">Generate TEA Package</i>.</p> |
| 171 |
<dl class="doctools_definitions"> |
| 172 |
<dt><b class="syscmd"><a href="critcl.html">critcl</a></b></dt> |
| 173 |
<dd></dd> |
| 174 |
<dt><b class="package">critcl::app</b></dt> |
| 175 |
<dd></dd> |
| 176 |
</dl> |
| 177 |
</li> |
| 178 |
<li><p>Below that is the core package providing the essential functionality |
| 179 |
of the system, plus various utility packages which make common tasks |
| 180 |
more convenient.</p> |
| 181 |
<dl class="doctools_definitions"> |
| 182 |
<dt><b class="package"><a href="critcl.html">critcl</a></b></dt> |
| 183 |
<dd></dd> |
| 184 |
<dt><b class="package"><a href="critcl_util.html">critcl::util</a></b></dt> |
| 185 |
<dd></dd> |
| 186 |
</dl> |
| 187 |
</li> |
| 188 |
<li><p>Lastly a layer of supporting packages, mostly external to critcl.</p> |
| 189 |
<dl class="doctools_definitions"> |
| 190 |
<dt><b class="package">md5</b></dt> |
| 191 |
<dd><p>For this pure-Tcl package to be fast users should get one of several |
| 192 |
possible accelerator packages:</p> |
| 193 |
<ol class="doctools_enumerated"> |
| 194 |
<li><p><b class="package">tcllibc</b></p></li> |
| 195 |
<li><p><b class="package">Trf</b></p></li> |
| 196 |
<li><p><b class="package">md5c</b></p></li> |
| 197 |
</ol></dd> |
| 198 |
<dt><b class="package">cmdline</b></dt> |
| 199 |
<dd></dd> |
| 200 |
<dt><b class="package">platform</b></dt> |
| 201 |
<dd></dd> |
| 202 |
<dt><b class="package">stubs::container</b></dt> |
| 203 |
<dd></dd> |
| 204 |
<dt><b class="package">stubs::reader</b></dt> |
| 205 |
<dd></dd> |
| 206 |
<dt><b class="package">stubs::writer</b></dt> |
| 207 |
<dd></dd> |
| 208 |
<dt><b class="package">stubs::gen</b></dt> |
| 209 |
<dd></dd> |
| 210 |
<dt><b class="package">stubs::gen::init</b></dt> |
| 211 |
<dd></dd> |
| 212 |
<dt><b class="package">stubs::gen::header</b></dt> |
| 213 |
<dd></dd> |
| 214 |
<dt><b class="package">stubs::gen::decl</b></dt> |
| 215 |
<dd></dd> |
| 216 |
<dt><b class="package">stubs::gen::macro</b></dt> |
| 217 |
<dd></dd> |
| 218 |
<dt><b class="package">stubs::gen::slot</b></dt> |
| 219 |
<dd></dd> |
| 220 |
<dt><b class="package">stubs::gen::lib</b></dt> |
| 221 |
<dd></dd> |
| 222 |
</dl> |
| 223 |
</li> |
| 224 |
</ol> |
| 225 |
</div> |
| 226 |
<div id="subsection2" class="doctools_subsection"><h3><a name="subsection2">Requirements</a></h3> |
| 227 |
<p>To develop for critcl the following packages and applications must be available in the |
| 228 |
environment. These are all used by the <b class="cmd">build.tcl</b> helper application.</p> |
| 229 |
<dl class="doctools_definitions"> |
| 230 |
<dt><b class="syscmd">dtplite</b></dt> |
| 231 |
<dd><p>A Tcl application provided by Tcllib, for the validation and conversion of |
| 232 |
<i class="term">doctools</i>-formatted text.</p></dd> |
| 233 |
<dt><b class="syscmd">dia</b></dt> |
| 234 |
<dd><p>A Tcl application provided by Tklib, for the validation and conversion |
| 235 |
of <b class="package">diagram</b>-formatted figures into raster images.</p> |
| 236 |
<p>Do not confuse this with the Gnome <b class="syscmd">dia</b> application, which is a graphical |
| 237 |
editor for figures and diagrams, and completely unrelated.</p></dd> |
| 238 |
<dt><b class="package">fileutil</b></dt> |
| 239 |
<dd><p>A Tcl package provided by Tcllib, providing file system utilities.</p></dd> |
| 240 |
<dt><b class="package">vfs::mk4</b>, <b class="package">vfs</b></dt> |
| 241 |
<dd><p>Tcl packages written in C providing access to Tcl's VFS facilities, required for the |
| 242 |
generation of critcl starkits and starpacks.</p></dd> |
| 243 |
</dl> |
| 244 |
</div> |
| 245 |
<div id="subsection3" class="doctools_subsection"><h3><a name="subsection3">Directory structure</a></h3> |
| 246 |
<dl class="doctools_definitions"> |
| 247 |
<dt>Helpers</dt> |
| 248 |
<dd><dl class="doctools_definitions"> |
| 249 |
<dt>"<b class="file">build.tcl</b>"</dt> |
| 250 |
<dd><p>This helper application provides various operations needed by a developer for critcl, like |
| 251 |
regenerating the documentation, the figures, building and installing critcl, etc.</p> |
| 252 |
<p>Running the command like</p> |
| 253 |
<pre class="doctools_example"> |
| 254 |
./build.tcl help |
| 255 |
</pre> |
| 256 |
<p>will provide more details about the available operations and their arguments.</p></dd> |
| 257 |
</dl></dd> |
| 258 |
<dt>Documentation</dt> |
| 259 |
<dd><dl class="doctools_definitions"> |
| 260 |
<dt>"<b class="file">doc/</b>"</dt> |
| 261 |
<dd><p>This directory contains the documentation sources, for both the text, and the figures. |
| 262 |
The texts are written in <i class="term">doctools</i> format, whereas the figures are written for |
| 263 |
tklib's <b class="package">dia</b>(gram) package and application.</p></dd> |
| 264 |
<dt>"<b class="file">embedded/</b>"</dt> |
| 265 |
<dd><p>This directory contains the documentation converted to regular manpages (nroff) and HTML. |
| 266 |
It is called embedded because these files, while derived, are part of the git repository, |
| 267 |
i.e. embedded into it. This enables us to place these files where they are visible when |
| 268 |
serving the prject's web interface.</p></dd> |
| 269 |
</dl></dd> |
| 270 |
<dt>Testsuite</dt> |
| 271 |
<dd><dl class="doctools_definitions"> |
| 272 |
<dt>"<b class="file">test/all.tcl</b>"</dt> |
| 273 |
<dd></dd> |
| 274 |
<dt>"<b class="file">test/testutilities.tcl</b>"</dt> |
| 275 |
<dd></dd> |
| 276 |
<dt>"<b class="file">test/*.test</b>"</dt> |
| 277 |
<dd><p>These files are a standard testsuite based on Tcl's <b class="package">tcltest</b> package, with some |
| 278 |
utility code snarfed from <b class="package">Tcllib</b>.</p> |
| 279 |
<p>This currently tests only some of the <b class="package">stubs::*</b> packages.</p></dd> |
| 280 |
<dt>"<b class="file">test/*.tcl</b>"</dt> |
| 281 |
<dd><p>These files (except for "<b class="file">all.tcl</b>" and "<b class="file">testutilities.tcl</b>") are example files |
| 282 |
(Tcl with embedded C) which can be run through critcl for testing.</p> |
| 283 |
<p><em>TODO</em> for a maintainers: These should be converted into a proper test suite.</p></dd> |
| 284 |
</dl></dd> |
| 285 |
<dt>Package Code, General structure</dt> |
| 286 |
<dd><dl class="doctools_definitions"> |
| 287 |
</dl></dd> |
| 288 |
<dt>Package Code, Per Package</dt> |
| 289 |
<dd><dl class="doctools_definitions"> |
| 290 |
<dt><b class="package"><a href="critcl.html">critcl</a></b></dt> |
| 291 |
<dd><dl class="doctools_definitions"> |
| 292 |
<dt>"<b class="file">lib/critcl/critcl.tcl</b>"</dt> |
| 293 |
<dd><p>The Tcl code implementing the package.</p></dd> |
| 294 |
<dt>"<b class="file">lib/critcl/Config</b>"</dt> |
| 295 |
<dd><p>The configuration file for the standard targets and their settings.</p></dd> |
| 296 |
<dt>"<b class="file">lib/critcl/critcl_c/</b>"</dt> |
| 297 |
<dd><p>Various C code snippets used by the package. |
| 298 |
This directory also contains the copies of the Tcl header files used to compile the |
| 299 |
assembled C code, for the major brnaches of Tcl, i.e. 8.4, 8.5, and 8.6.</p></dd> |
| 300 |
</dl></dd> |
| 301 |
<dt><b class="package"><a href="critcl_util.html">critcl::util</a></b></dt> |
| 302 |
<dd><dl class="doctools_definitions"> |
| 303 |
<dt>"<b class="file">lib/critcl-util/util.tcl</b>"</dt> |
| 304 |
<dd><p>The Tcl code implementing the package.</p></dd> |
| 305 |
</dl></dd> |
| 306 |
<dt><b class="package">critcl::app</b></dt> |
| 307 |
<dd><dl class="doctools_definitions"> |
| 308 |
<dt>"<b class="file">lib/app-critcl/critcl.tcl</b>"</dt> |
| 309 |
<dd><p>The Tcl code implementing the package.</p></dd> |
| 310 |
</dl></dd> |
| 311 |
<dt><b class="package"><a href="critcl_iassoc.html">critcl::iassoc</a></b></dt> |
| 312 |
<dd><dl class="doctools_definitions"> |
| 313 |
<dt>"<b class="file">lib/critcl-iassoc/iassoc.tcl</b>"</dt> |
| 314 |
<dd><p>The Tcl code implementing the package.</p></dd> |
| 315 |
<dt>"<b class="file">lib/critcl-iassoc/iassoc.h</b>"</dt> |
| 316 |
<dd><p>C code template used by the package.</p></dd> |
| 317 |
</dl></dd> |
| 318 |
<dt><b class="package"><a href="critcl_class.html">critcl::class</a></b></dt> |
| 319 |
<dd><dl class="doctools_definitions"> |
| 320 |
<dt>"<b class="file">lib/critcl-class/class.tcl</b>"</dt> |
| 321 |
<dd><p>The Tcl code implementing the package.</p></dd> |
| 322 |
<dt>"<b class="file">lib/critcl-class/class.h</b>"</dt> |
| 323 |
<dd><p>C code template used by the package.</p></dd> |
| 324 |
</dl></dd> |
| 325 |
<dt><b class="package">stubs::*</b></dt> |
| 326 |
<dd><dl class="doctools_definitions"> |
| 327 |
<dt>"<b class="file">lib/stubs/*</b>"</dt> |
| 328 |
<dd><p>A set of non-public (still) packages which provide read and write access to and represent |
| 329 |
Tcl stubs tables. These were created by taking the "<b class="file">genStubs.tcl</b>" helper application |
| 330 |
coming with the Tcl core sources apart along its internal logical lines.</p></dd> |
| 331 |
</dl></dd> |
| 332 |
<dt><b class="package">critclf</b></dt> |
| 333 |
<dd><dl class="doctools_definitions"> |
| 334 |
<dt>"<b class="file">lib/critclf/</b>"</dt> |
| 335 |
<dd><p>Arjen Markus' work on a critcl/Fortran. The code is outdated and has not been adapted to |
| 336 |
the changes in critcl version 3 yet.</p></dd> |
| 337 |
</dl></dd> |
| 338 |
<dt><b class="package">md5</b></dt> |
| 339 |
<dd></dd> |
| 340 |
<dt><b class="package">md5c</b></dt> |
| 341 |
<dd></dd> |
| 342 |
<dt><b class="package">platform</b></dt> |
| 343 |
<dd><p>These are all external packages whose code has been inlined in the repository for easier |
| 344 |
development (less dependencies to pull), and quicker deployment from the repository |
| 345 |
(generation of starkit and -pack).</p> |
| 346 |
<p><em>TODO</em> for maintainers: These should all be checked against their origin for |
| 347 |
updates and changes since they were inlined.</p></dd> |
| 348 |
</dl></dd> |
| 349 |
</dl> |
| 350 |
</div> |
| 351 |
</div> |
| 352 |
<div id="section5" class="doctools_section"><h2><a name="section5">Authors</a></h2> |
| 353 |
<p>Jean Claude Wippler, Steve Landers, Andreas Kupries</p> |
| 354 |
</div> |
| 355 |
<div id="section6" class="doctools_section"><h2><a name="section6">Bugs, Ideas, Feedback</a></h2> |
| 356 |
<p>This document, and the package it describes, will undoubtedly contain |
| 357 |
bugs and other problems. |
| 358 |
Please report them at <a href="https://github.com/andreas-kupries/critcl/issues">https://github.com/andreas-kupries/critcl/issues</a>. |
| 359 |
Ideas for enhancements you may have for either package, application, |
| 360 |
and/or the documentation are also very welcome and should be reported |
| 361 |
at <a href="https://github.com/andreas-kupries/critcl/issues">https://github.com/andreas-kupries/critcl/issues</a> as well.</p> |
| 362 |
</div> |
| 363 |
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2> |
| 364 |
<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 & 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> |
| 365 |
</div> |
| 366 |
<div id="category" class="doctools_section"><h2><a name="category">Category</a></h2> |
| 367 |
<p>Glueing/Embedded C code</p> |
| 368 |
</div> |
| 369 |
<div id="copyright" class="doctools_section"><h2><a name="copyright">Copyright</a></h2> |
| 370 |
<p>Copyright © Jean-Claude Wippler<br> |
| 371 |
Copyright © Steve Landers<br> |
| 372 |
Copyright © 2011-2024 Andreas Kupries</p> |
| 373 |
</div> |
| 374 |
</div></body></html> |