~ubuntu-branches/ubuntu/utopic/critcl/utopic

« back to all changes in this revision

Viewing changes to embedded/man/files/critcl_devguide.n

  • Committer: Package Import Robot
  • Author(s): Andrew Shadura
  • Date: 2013-05-11 00:08:06 UTC
  • Revision ID: package-import@ubuntu.com-20130511000806-7hq1zc3fnn0gat79
Tags: upstream-3.1.9
ImportĀ upstreamĀ versionĀ 3.1.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'\"
 
2
'\" Generated from file '/home/aku/Projects/Packages/Critcl/dev-master/embedded/man/files/critcl_devguide\&.n' by tcllib/doctools with format 'nroff'
 
3
'\" Copyright (c) Jean-Claude Wippler
 
4
'\" Copyright (c) Steve Landers
 
5
'\" Copyright (c) 2011-2013 Andreas Kupries
 
6
'\"
 
7
'\" The definitions below are for supplemental macros used in Tcl/Tk
 
8
'\" manual entries.
 
9
'\"
 
10
'\" .AP type name in/out ?indent?
 
11
'\"     Start paragraph describing an argument to a library procedure.
 
12
'\"     type is type of argument (int, etc.), in/out is either "in", "out",
 
13
'\"     or "in/out" to describe whether procedure reads or modifies arg,
 
14
'\"     and indent is equivalent to second arg of .IP (shouldn't ever be
 
15
'\"     needed;  use .AS below instead)
 
16
'\"
 
17
'\" .AS ?type? ?name?
 
18
'\"     Give maximum sizes of arguments for setting tab stops.  Type and
 
19
'\"     name are examples of largest possible arguments that will be passed
 
20
'\"     to .AP later.  If args are omitted, default tab stops are used.
 
21
'\"
 
22
'\" .BS
 
23
'\"     Start box enclosure.  From here until next .BE, everything will be
 
24
'\"     enclosed in one large box.
 
25
'\"
 
26
'\" .BE
 
27
'\"     End of box enclosure.
 
28
'\"
 
29
'\" .CS
 
30
'\"     Begin code excerpt.
 
31
'\"
 
32
'\" .CE
 
33
'\"     End code excerpt.
 
34
'\"
 
35
'\" .VS ?version? ?br?
 
36
'\"     Begin vertical sidebar, for use in marking newly-changed parts
 
37
'\"     of man pages.  The first argument is ignored and used for recording
 
38
'\"     the version when the .VS was added, so that the sidebars can be
 
39
'\"     found and removed when they reach a certain age.  If another argument
 
40
'\"     is present, then a line break is forced before starting the sidebar.
 
41
'\"
 
42
'\" .VE
 
43
'\"     End of vertical sidebar.
 
44
'\"
 
45
'\" .DS
 
46
'\"     Begin an indented unfilled display.
 
47
'\"
 
48
'\" .DE
 
49
'\"     End of indented unfilled display.
 
50
'\"
 
51
'\" .SO
 
52
'\"     Start of list of standard options for a Tk widget.  The
 
53
'\"     options follow on successive lines, in four columns separated
 
54
'\"     by tabs.
 
55
'\"
 
56
'\" .SE
 
57
'\"     End of list of standard options for a Tk widget.
 
58
'\"
 
59
'\" .OP cmdName dbName dbClass
 
60
'\"     Start of description of a specific option.  cmdName gives the
 
61
'\"     option's name as specified in the class command, dbName gives
 
62
'\"     the option's name in the option database, and dbClass gives
 
63
'\"     the option's class in the option database.
 
64
'\"
 
65
'\" .UL arg1 arg2
 
66
'\"     Print arg1 underlined, then print arg2 normally.
 
67
'\"
 
68
'\" RCS: @(#) $Id: man.macros,v 1.1 2009/01/30 04:56:47 andreas_kupries Exp $
 
69
'\"
 
70
'\"     # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
 
71
.if t .wh -1.3i ^B
 
72
.nr ^l \n(.l
 
73
.ad b
 
74
'\"     # Start an argument description
 
75
.de AP
 
76
.ie !"\\$4"" .TP \\$4
 
77
.el \{\
 
78
.   ie !"\\$2"" .TP \\n()Cu
 
79
.   el          .TP 15
 
80
.\}
 
81
.ta \\n()Au \\n()Bu
 
82
.ie !"\\$3"" \{\
 
83
\&\\$1  \\fI\\$2\\fP    (\\$3)
 
84
.\".b
 
85
.\}
 
86
.el \{\
 
87
.br
 
88
.ie !"\\$2"" \{\
 
89
\&\\$1  \\fI\\$2\\fP
 
90
.\}
 
91
.el \{\
 
92
\&\\fI\\$1\\fP
 
93
.\}
 
94
.\}
 
95
..
 
96
'\"     # define tabbing values for .AP
 
97
.de AS
 
98
.nr )A 10n
 
99
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
 
100
.nr )B \\n()Au+15n
 
101
.\"
 
102
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
 
103
.nr )C \\n()Bu+\\w'(in/out)'u+2n
 
104
..
 
105
.AS Tcl_Interp Tcl_CreateInterp in/out
 
106
'\"     # BS - start boxed text
 
107
'\"     # ^y = starting y location
 
108
'\"     # ^b = 1
 
109
.de BS
 
110
.br
 
111
.mk ^y
 
112
.nr ^b 1u
 
113
.if n .nf
 
114
.if n .ti 0
 
115
.if n \l'\\n(.lu\(ul'
 
116
.if n .fi
 
117
..
 
118
'\"     # BE - end boxed text (draw box now)
 
119
.de BE
 
120
.nf
 
121
.ti 0
 
122
.mk ^t
 
123
.ie n \l'\\n(^lu\(ul'
 
124
.el \{\
 
125
.\"     Draw four-sided box normally, but don't draw top of
 
126
.\"     box if the box started on an earlier page.
 
127
.ie !\\n(^b-1 \{\
 
128
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
 
129
.\}
 
130
.el \}\
 
131
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
 
132
.\}
 
133
.\}
 
134
.fi
 
135
.br
 
136
.nr ^b 0
 
137
..
 
138
'\"     # VS - start vertical sidebar
 
139
'\"     # ^Y = starting y location
 
140
'\"     # ^v = 1 (for troff;  for nroff this doesn't matter)
 
141
.de VS
 
142
.if !"\\$2"" .br
 
143
.mk ^Y
 
144
.ie n 'mc \s12\(br\s0
 
145
.el .nr ^v 1u
 
146
..
 
147
'\"     # VE - end of vertical sidebar
 
148
.de VE
 
149
.ie n 'mc
 
150
.el \{\
 
151
.ev 2
 
152
.nf
 
153
.ti 0
 
154
.mk ^t
 
155
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
 
156
.sp -1
 
157
.fi
 
158
.ev
 
159
.\}
 
160
.nr ^v 0
 
161
..
 
162
'\"     # Special macro to handle page bottom:  finish off current
 
163
'\"     # box/sidebar if in box/sidebar mode, then invoked standard
 
164
'\"     # page bottom macro.
 
165
.de ^B
 
166
.ev 2
 
167
'ti 0
 
168
'nf
 
169
.mk ^t
 
170
.if \\n(^b \{\
 
171
.\"     Draw three-sided box if this is the box's first page,
 
172
.\"     draw two sides but no top otherwise.
 
173
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
 
174
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
 
175
.\}
 
176
.if \\n(^v \{\
 
177
.nr ^x \\n(^tu+1v-\\n(^Yu
 
178
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
 
179
.\}
 
180
.bp
 
181
'fi
 
182
.ev
 
183
.if \\n(^b \{\
 
184
.mk ^y
 
185
.nr ^b 2
 
186
.\}
 
187
.if \\n(^v \{\
 
188
.mk ^Y
 
189
.\}
 
190
..
 
191
'\"     # DS - begin display
 
192
.de DS
 
193
.RS
 
194
.nf
 
195
.sp
 
196
..
 
197
'\"     # DE - end display
 
198
.de DE
 
199
.fi
 
200
.RE
 
201
.sp
 
202
..
 
203
'\"     # SO - start of list of standard options
 
204
.de SO
 
205
.SH "STANDARD OPTIONS"
 
206
.LP
 
207
.nf
 
208
.ta 4c 8c 12c
 
209
.ft B
 
210
..
 
211
'\"     # SE - end of list of standard options
 
212
.de SE
 
213
.fi
 
214
.ft R
 
215
.LP
 
216
See the \\fBoptions\\fR manual entry for details on the standard options.
 
217
..
 
218
'\"     # OP - start of full description for a single option
 
219
.de OP
 
220
.LP
 
221
.nf
 
222
.ta 4c
 
223
Command-Line Name:      \\fB\\$1\\fR
 
224
Database Name:  \\fB\\$2\\fR
 
225
Database Class: \\fB\\$3\\fR
 
226
.fi
 
227
.IP
 
228
..
 
229
'\"     # CS - begin code excerpt
 
230
.de CS
 
231
.RS
 
232
.nf
 
233
.ta .25i .5i .75i 1i
 
234
..
 
235
'\"     # CE - end code excerpt
 
236
.de CE
 
237
.fi
 
238
.RE
 
239
..
 
240
.de UL
 
241
\\$1\l'|0\(ul'\\$2
 
242
..
 
243
.TH "critcl_devguide" n 3\&.1\&.8 doc "C Runtime In Tcl (CriTcl)"
 
244
.BS
 
245
.SH NAME
 
246
critcl_devguide \- Critcl - The Developer's Guide
 
247
.SH DESCRIPTION
 
248
Welcome to the \fIC Runtime In Tcl\fR, \fICriTcl\fR for short, a
 
249
system to build C extension packages for Tcl on the fly, from C code
 
250
embedded within Tcl scripts, for all who wish to make their code go
 
251
faster\&.
 
252
.PP
 
253
This document is a guide for developers working on Critcl,
 
254
i\&.e\&. maintainers fixing bugs, extending the package's functionality,
 
255
etc\&.
 
256
.PP
 
257
Please read
 
258
.IP [1]
 
259
\fICritcl - License\fR,
 
260
.IP [2]
 
261
\fICritcl - How To Get The Sources\fR, and
 
262
.IP [3]
 
263
\fICritcl - The Installer's Guide\fR
 
264
.PP
 
265
first, if that was not done already\&.
 
266
.PP
 
267
Here we assume that the sources are already available in a directory
 
268
of your choice, and that you not only know how to build and install
 
269
them, but also have all the necessary requisites to actually do
 
270
so\&. The guide to the sources in particular also explains which source
 
271
code management system is used, where to find it, how to set it up,
 
272
etc\&.
 
273
.SH "PLAYING WITH CRITCL"
 
274
.PP
 
275
The sources of Critcl, should you have gotten them, contain
 
276
several larger examples show-casing various aspects of the
 
277
system\&. These demonstration packages can all be found in the
 
278
sub-directory "\fIexamples/\fR" of the sources\&.
 
279
.PP
 
280
Lots of smaller examples can be found in the document
 
281
\fIUsing CriTcl\fR, an introduction to Critcl by way of a of
 
282
examples\&. These focus more on specific critcl commands than the
 
283
overall picture shown by the large examples mentioned in the previous
 
284
paragraph\&.
 
285
.SH "DEVELOPING FOR CRITCL"
 
286
.SS "ARCHITECTURE & CONCEPTS"
 
287
The system consists of two main layers, as seen in the figure below,
 
288
plus a support layer containing general packages the system uses during
 
289
operation\&.
 
290
.PP
 
291
.PS
 
292
.nf
 
293
+----------------+
 
294
|Applications    |
 
295
| critcl         |
 
296
| critcl::app    |
 
297
+----------------+
 
298
 
 
299
+----------------+
 
300
|Core Packages   |
 
301
| critcl         |
 
302
| critcl::util   |
 
303
+----------------+
 
304
 
 
305
+----------------+
 
306
|Support Packages|
 
307
| stubs::*       |
 
308
| md5, platform  |
 
309
|  \&.\&.\&.           |
 
310
+----------------+
 
311
 
 
312
.fi
 
313
.PE
 
314
.PP
 
315
.IP [1]
 
316
At the top we have an application built on top of the core packages,
 
317
providing command line access to the second and third usage modes,
 
318
i\&.e\&. \fIGenerate Package\fR and \fIGenerate TEA Package\fR\&.
 
319
.RS
 
320
.TP
 
321
\fBcritcl\fR
 
322
.TP
 
323
\fBcritcl::app\fR
 
324
.RE
 
325
.IP [2]
 
326
Below that is the core package providing the essential functionality
 
327
of the system, plus various utility packages which make common tasks
 
328
more convenient\&.
 
329
.RS
 
330
.TP
 
331
\fBcritcl\fR
 
332
.TP
 
333
\fBcritcl::util\fR
 
334
.RE
 
335
.IP [3]
 
336
Lastly a layer of supporting packages, mostly external to critcl\&.
 
337
.RS
 
338
.TP
 
339
\fBmd5\fR
 
340
For this pure-Tcl package to be fast users should get one of several
 
341
possible accelerator packages:
 
342
.RS
 
343
.IP [1]
 
344
\fBtcllibc\fR
 
345
.IP [2]
 
346
\fBTrf\fR
 
347
.IP [3]
 
348
\fBmd5c\fR
 
349
.RE
 
350
.TP
 
351
\fBcmdline\fR
 
352
.TP
 
353
\fBplatform\fR
 
354
.TP
 
355
\fBstubs::container\fR
 
356
.TP
 
357
\fBstubs::reader\fR
 
358
.TP
 
359
\fBstubs::writer\fR
 
360
.TP
 
361
\fBstubs::gen\fR
 
362
.TP
 
363
\fBstubs::gen::init\fR
 
364
.TP
 
365
\fBstubs::gen::header\fR
 
366
.TP
 
367
\fBstubs::gen::decl\fR
 
368
.TP
 
369
\fBstubs::gen::macro\fR
 
370
.TP
 
371
\fBstubs::gen::slot\fR
 
372
.TP
 
373
\fBstubs::gen::lib\fR
 
374
.RE
 
375
.PP
 
376
.SS REQUIREMENTS
 
377
To develop for critcl the following packages and applications must be
 
378
available in the environment\&. These are all used by the \fBbuild\&.tcl\fR
 
379
helper application\&.
 
380
.TP
 
381
\fBdtplite\fR
 
382
A Tcl application provided by Tcllib, for the validation and
 
383
conversion of \fIdoctools\fR-formatted text\&.
 
384
.TP
 
385
\fBdia\fR
 
386
A Tcl application provided by Tklib, for the validation and conversion
 
387
of \fBdiagram\fR-formatted figures into raster images\&.
 
388
.sp
 
389
Do not confuse this with the Gnome \fBdia\fR application,
 
390
which is a graphical editor for figures and diagrams, and completely
 
391
unrelated\&.
 
392
.TP
 
393
\fBfileutil\fR
 
394
A Tcl package provided by Tcllib, providing file system utilities\&.
 
395
.TP
 
396
\fBvfs::mk4\fR, \fBvfs\fR
 
397
Tcl packages written in C providing access to Tcl's VFS facilities,
 
398
required for the generation of critcl starkits and starpacks\&.
 
399
.PP
 
400
.SS "DIRECTORY STRUCTURE"
 
401
.TP
 
402
Helpers
 
403
.RS
 
404
.TP
 
405
"\fIbuild\&.tcl\fR"
 
406
This helper application provides various operations needed by a
 
407
developer for critcl, like regenerating the documentation, the
 
408
figures, building and installing critcl, etc\&.
 
409
.sp
 
410
Running the command like
 
411
.CS
 
412
 
 
413
 
 
414
        \&./build\&.tcl help
 
415
 
 
416
.CE
 
417
.IP
 
418
will provide more details about the available operations and their
 
419
arguments\&.
 
420
.RE
 
421
.TP
 
422
Documentation
 
423
.RS
 
424
.TP
 
425
"\fIdoc/\fR"
 
426
This directory contains the documentation sources, for both the text, and the figures\&.
 
427
The texts are written in \fIdoctools\fR format, whereas the figures are written for
 
428
tklib's \fBdia\fR(gram) package and application\&.
 
429
.TP
 
430
"\fIembedded/\fR"
 
431
This directory contains the documentation converted to regular manpages
 
432
(nroff) and HTML\&.
 
433
It is called embedded because these files, while derived, are part of the
 
434
git repository, i\&.e\&. embedded into it\&. This enables us to place these files
 
435
where they are visible when serving the prject's web interface\&.
 
436
.RE
 
437
.TP
 
438
Testsuite
 
439
.RS
 
440
.TP
 
441
"\fItest/all\&.tcl\fR"
 
442
.TP
 
443
"\fItest/testutilities\&.tcl\fR"
 
444
.TP
 
445
"\fItest/*\&.test\fR"
 
446
These files are a standard testsuite based on Tcl's \fBtcltest\fR package,
 
447
with some utility code snarfed from \fBTcllib\fR\&.
 
448
.sp
 
449
This currently tests only some of the \fBstubs::*\fR packages\&.
 
450
.TP
 
451
"\fItest/*\&.tcl\fR"
 
452
These files (but not "\fIall\&.tcl\fR", and "\fItestutilities\&.tcl\fR") are
 
453
example files (Tcl with embedded C) which can be run through critcl for testing\&.
 
454
.sp
 
455
\fITODO:\fR These should be converted into a proper test suite\&.
 
456
.RE
 
457
.TP
 
458
Package Code, General structure
 
459
.RS
 
460
.RE
 
461
.TP
 
462
Package Code, Per Package
 
463
.RS
 
464
.TP
 
465
\fBcritcl\fR
 
466
.RS
 
467
.TP
 
468
"\fIlib/critcl/critcl\&.tcl\fR"
 
469
The Tcl code implementing the package\&.
 
470
.TP
 
471
"\fIlib/critcl/Config\fR"
 
472
The configuration file for the standard targets and their settings\&.
 
473
.TP
 
474
"\fIlib/critcl/critcl_c/\fR"
 
475
Various C code snippets used by the package\&.
 
476
This directory also contains the copies of the Tcl header files used
 
477
to compile the assembled C code, for the major brnaches of Tcl,
 
478
i\&.e\&. 8\&.4, 8\&.5, and 8\&.6\&.
 
479
.RE
 
480
.TP
 
481
\fBcritcl::util\fR
 
482
.RS
 
483
.TP
 
484
"\fIlib/critcl-util/util\&.tcl\fR"
 
485
The Tcl code implementing the package\&.
 
486
.RE
 
487
.TP
 
488
\fBcritcl::app\fR
 
489
.RS
 
490
.TP
 
491
"\fIlib/app-critcl/critcl\&.tcl\fR"
 
492
The Tcl code implementing the package\&.
 
493
.RE
 
494
.TP
 
495
\fBcritcl::iassoc\fR
 
496
.RS
 
497
.TP
 
498
"\fIlib/critcl-iassoc/iassoc\&.tcl\fR"
 
499
The Tcl code implementing the package\&.
 
500
.TP
 
501
"\fIlib/critcl-iassoc/iassoc\&.h\fR"
 
502
C code template used by the package\&.
 
503
.RE
 
504
.TP
 
505
\fBcritcl::class\fR
 
506
.RS
 
507
.TP
 
508
"\fIlib/critcl-class/class\&.tcl\fR"
 
509
The Tcl code implementing the package\&.
 
510
.TP
 
511
"\fIlib/critcl-class/class\&.h\fR"
 
512
C code template used by the package\&.
 
513
.RE
 
514
.TP
 
515
\fBdict84\fR
 
516
.TP
 
517
\fBlassign84\fR
 
518
.RS
 
519
.TP
 
520
"\fIlib/util84/dict\&.tcl\fR"
 
521
.TP
 
522
"\fIlib/util84/lassign\&.tcl\fR"
 
523
These are two packages implementing forward compatibility emulations
 
524
of the \fBdict\fR and \fBlassign\fR commands introduced with Tcl 8\&.5\&.
 
525
These are used automatically when critcl is run by Tcl 8\&.4\&.
 
526
.RE
 
527
.TP
 
528
\fBstubs::*\fR
 
529
.RS
 
530
.TP
 
531
"\fIlib/stubs/*\fR"
 
532
A set of non-public (still) packages which provide read and write
 
533
access to and represent Tcl stubs tables\&. These were created by taking
 
534
the "\fIgenStubs\&.tcl\fR" helper application coming with the Tcl core
 
535
sources apart along its internal logical lines\&.
 
536
.RE
 
537
.TP
 
538
\fBcritclf\fR
 
539
.RS
 
540
.TP
 
541
"\fIlib/critclf/\fR"
 
542
Arjen Markus' work on a critcl/Fortran\&. The code is outdated and has
 
543
not been adapted to the changes in critcl version 3 yet\&.
 
544
.RE
 
545
.TP
 
546
\fBautoscroll\fR
 
547
.TP
 
548
\fBcmdline\fR
 
549
.TP
 
550
\fBmd5\fR
 
551
.TP
 
552
\fBmd5c\fR
 
553
.TP
 
554
\fBplatform\fR
 
555
.TP
 
556
\fBsnit\fR
 
557
.TP
 
558
\fBsnitbutton\fR
 
559
.TP
 
560
\fBwikit\fR
 
561
These are all external packages whose code has been inlined in the
 
562
repository for easier development (less dependencies to pull), and
 
563
quicker deployment from the repository (generation of starkit and
 
564
-pack)\&.
 
565
.sp
 
566
The packages
 
567
\fBautoscroll\fR,
 
568
\fBsnit\fR,
 
569
\fBsnitbutton\fR, and
 
570
\fBwikit\fR
 
571
are for the support of the Wikit GUI accessible from starkit and -pack
 
572
when the application functionality (\fBcritcl::app\fR) is run with
 
573
an empty command line\&.
 
574
.sp
 
575
\fITODO:\fR These should all be checked against their origin
 
576
for updates and changes since they were inlined\&.
 
577
.RE
 
578
.PP
 
579
.SH AUTHORS
 
580
Jean Claude Wippler, Steve Landers, Andreas Kupries
 
581
.SH "BUGS, IDEAS, FEEDBACK"
 
582
This document, and the package it describes, will undoubtedly contain
 
583
bugs and other problems\&.
 
584
Please report them at \fIhttps://github\&.com/andreas-kupries/critcl/issues\fR\&.
 
585
Ideas for enhancements you may have for either package, application,
 
586
and/or the documentation are also very welcome and should be reported
 
587
at \fIhttps://github\&.com/andreas-kupries/critcl/issues\fR as well\&.
 
588
.SH KEYWORDS
 
589
C code, Embedded C Code, code generator, compile & run, compiler, dynamic code generation, dynamic compilation, generate package, linker, on demand compilation, on-the-fly compilation
 
590
.SH CATEGORY
 
591
Glueing/Embedded C code
 
592
.SH COPYRIGHT
 
593
.nf
 
594
Copyright (c) Jean-Claude Wippler
 
595
Copyright (c) Steve Landers
 
596
Copyright (c) 2011-2013 Andreas Kupries
 
597
 
 
598
.fi
 
 
b'\\ No newline at end of file'